Home › Forums › Front-end Issues › Display ACF fields that are modified by filters › Reply To: Display ACF fields that are modified by filters
$field = get_field_object( 'custom_field' );
echo '<pre>'; print_r($field['choices']); echo '</pre>';
//Displays
Array
(
[ID] => 177
[key] => field_5dcf111592fe2
[label] => Custom Color
[name] => custom_field
[prefix] => acf
[type] => select
[value] => blue
[menu_order] => 0
[instructions] =>
[required] => 0
[id] =>
[class] =>
[conditional_logic] => Array
(
[0] => Array
(
[0] => Array
(
[field] => field_5dcf0ad861cf1
[operator] => ==
[value] => background
)
)
)
[parent] => 176
[wrapper] => Array
(
[width] =>
[class] =>
[id] =>
)
[choices] => Array
(
[Blue] => Blue
[Red] => Red
[Green] => Green
[Yellow] => Yellow
[White] => White
[Pink] => Pink
)
[default_value] => Array
(
)
[allow_null] => 1
[multiple] => 0
[ui] => 0
[return_format] => value
[ajax] => 0
[placeholder] =>
[_name] => background
[_valid] => 1
)
$value = get_post_meta( $post_id, 'custom_field', true );
echo $value;
//Displays
blue
I see the intended choices when I go into edit the custom fields. The select menu shows me:
blue : Blue
red : Red
green : Green
yellow : Yellow
white : White
pink : Pink
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.