You’re still loosing me.
We’re talking about an ACF select field. When you create the field you set the choices.
get_field('field_name') will get what has been selected for a specific post.
get_field_object('field_name') will get the field object, including the the choices you have defined. However, this call (using the field name) will only work if this field has been updated and has a value assigned to it.
if you want to get a field object even when no value has previously been saved to it then you need to use the field key.
get_field('field_1234567') where ‘field_1234567’ represents the field key of the select field.
When you get the field object
$field = get_field_object($selector) $field will contain all the setting for the field and the choices that you’ve set for the field will be in
$field['choices']. This will be an array containing
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!