I have a checkbox field that was working fine.
I made a text edit to one of the options.
Now if I add a new post, the acf fields appears and are checked correctly on ‘page edit’ but if I publish the post nothing shows in the display.
This is only for new posts, the old posts are still displaying the field the correctly.
I try to debug using
$select_object = get_field_object('specialties');
var_dump($select_object);
and it returns bool(false)
If I do the_field('specialties');
it returns the first checkbox option.
$field = get_field_object('specialties');
$value = $field['value'];
$choices = $field['choices'];
$comma = "";
if( $value ):
foreach( $value as $v ):
echo $comma;
if ($choices[ $v ] === "Other"):
the_field('other_3');
else:
echo $choices[ $v ];
endif;
$comma = ", ";
endforeach;
endif;
returns nothing for new posts, but works for old posts.
How can I fix this? Is this b/c of the text change? Do I need need to clear cache somwhere?
issue fixed.
There was a spelling error in the field name.
The confusion was that the old posts were displaying the field correctly, maybe this is a caching issue?