I’m using Advanced Custom Fields / ACF to create custom fields. One of them is a list of checkboxes that display some options (option1, option2, option3…).
Now I want to display all options of this field on a separate page on the frontend like so:
Options:
– option 1
– option 2
– option 3
– …
How can I retrieve all options with keys from ACF?
The get_field_object
ACF function can be used to get info and options for a specific field.
First you need the field key of the specific field you wish to output. When editing a field group, click on the screen options tab at the top of the page. You should see an option to toggle the display of the field key (it is hidden by default to save space):

Once you have the key, you can load the field object and output its values:
$field_key = "field_5039a99716d1d";
$field = get_field_object($field_key);
if( $field )
{
echo '<select name="' . $field['key'] . '">';
foreach( $field['choices'] as $k => $v )
{
echo '<option value="' . $k . '">' . $v . '</option>';
}
echo '</select>';
}