Home Forums ACF PRO get_field_object returning bool(false)


get_field_object returning bool(false)

  • 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'); 

    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"): 
    								echo $choices[ $v ];
    							$comma = ", ";

    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?

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.