Home › Forums › Front-end Issues › Get Select Field Options › Reply To: Get Select Field Options
No, you are correct. Regardless of the time of field, it the field does not exist, especially a field like a taxonomy field that contains more than simple text, you cannot get the value of the field after using update_field() with the field name. ACF cannot create the field key reference and this is why the field appears blank even when it has content. You need to use the field key to do the updates. It is possible to get the field keys, you are already using the field name, that you have to code in some way, you just need to substitute the field keys.
Generally when I need to do this I create an array that holds field name => field key pairs
$fields_refs = array(
'name of field 1' => 'field_123456',
'name of field 2' => 'field_234567',
// etc...
)
Then I can do something like
update_field($field_refs['name of field 1'], $value, post_id);
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.