Support

Account

Home Forums ACF PRO get_field_objects() with Post Object fields

Helping

get_field_objects() with Post Object fields

  • I am trying to display all custom fields for each post in a query with the example provided here:

    http://www.advancedcustomfields.com/resources/get_field_objects/

    /*
    *  get all custom fields, loop through them and create a label => value markup
    */
    
    $fields = get_field_objects();
    
    if( $fields )
    {
    	foreach( $fields as $field_name => $field )
    	{
    		echo '<div>';
    			echo '<h3>' . $field['label'] . '</h3>';
    			echo $field['value'];
    		echo '</div>';
    	}
    }

    However, I am getting an error for Post Object fields:

    Catchable fatal error: Object of class WP_Term could not be converted to string

  • Bumping for visibility

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

The topic ‘get_field_objects() with Post Object fields’ is closed to new replies.