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 (  => Array (  => 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!
CPT registration is coming to ACF! We demoed the new feature during the most recent session of ACF Chat Fridays. Check out the summary for the details. https://t.co/k2KQ3WWBAz— Advanced Custom Fields (@wp_acf) March 7, 2023
© 2023 Advanced Custom Fields.