Home › Forums › General Issues › Strange Behavior with field data and get_field › Reply To: Strange Behavior with field data and get_field
Actually, yes, when using update_field() is is best to assume that the field has no value and always use the field key.
The documentation should actually say that in my opinion, but not much I can do about that.
Any value in the database, even an empty string. What matters is that ACF creates two entries in the database, one has a meta_key of your field name and the other has a meta_key of your field name prepended with an underscore _{$field_name}
. If both of these exist then you can use the field name. ACF actually uses the field key for everything because they are unique. Field names are only provided for our convenience. If you look at an admin page with fields and inspect you will find that all of the inputs use the field key for the field name.
The only time this is not the case is when using an acf/save_post with a priority of > 10 and you can be sure that ACF has already created a DB entry for the field and you intend to change it for some reason.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.