Home › Forums › General Issues › list all values in select field › Reply To: list all values in select field
Hi guys,
This is something you can accomplish using get_field_object(...)
function. get_field_object(...)
will return a field object. You can get the choices using the following code:
$field = get_field_object('select_field', 1);
$choices = $field['choices'];
foreach($choices as $choice):
echo $choice;
endforeach;
For more information on this, have a look at: http://www.advancedcustomfields.com/resources/get_field_object/
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.