Support

Account

Home Forums Bug Reports Errors in Post Object field ( ACF 5.7.2 )

Solved

Errors in Post Object field ( ACF 5.7.2 )

  • This happens during the taxonomy part of the field, I get the following errors:

    Undefined index: Category in \wp-content\plugins\advanced-custom-fields-pro\includes\api\api-term.php on line 84

    Undefined index: Tag in \wp-content\plugins\advanced-custom-fields-pro\includes\api\api-term.php on line 84
    
    Trying to get property of non-object in \wp-content\plugins\advanced-custom-fields-pro\includes\api\api-helpers.php on line 1298
    
    Trying to get property of non-object in \wp-content\plugins\advanced-custom-fields-pro\includes\api\api-helpers.php on line 1315
    
    Trying to get property of non-object in \wp-content\plugins\advanced-custom-fields-pro\includes\api\api-helpers.php on line 1327

    I have stack traces too if needed. It pretty much destroys the rest of the field rendering after these errors.

  • Hi @howdy_mcgee

    Thanks for the bug report,
    Elliot here – ACF dev​​​.

    Sorry about this issue, it is easily solved.
    Can you please edit the ‘api-terms.php’ file in question and change the acf_get_taxonomy_labels() function to:

    
    function acf_get_taxonomy_labels( $taxonomies = array() ) {
    	
    	// default
    	if( empty($taxonomies) ) {
    		$taxonomies = acf_get_taxonomies();
    	}
    	
    	// vars
    	$ref = array();
    	$data = array();
    	
    	// loop
    	foreach( $taxonomies as $taxonomy ) {
    		
    		// vars
    		$object = get_taxonomy( $taxonomy );
    		$label = $object->labels->singular_name;
    		
    		// append
    		$data[ $taxonomy ] = $label;
    		
    		// increase counter
    		if( !isset($ref[ $label ]) ) {
    			$ref[ $label ] = 0;
    		}
    		$ref[ $label ]++;
    	}
    	
    	// show taxonomy name next to label for shared labels
    	foreach( $data as $taxonomy => $label ) {
    		if( $ref[$label] > 1 ) {
    			$data[ $taxonomy ] .= ' (' . $taxonomy . ')';
    		}
    	}
    	
    	// return
    	return $data;
    }
    
  • Hello,

    We have the same problem. Every post object field is broken. Error message is: Uncaught TypeError: Cannot read property 'collapsedLayouts-13288' of null.

    Solved this by restoring version 5.7.1. Please fix asap!

  • Any progress on this? we were forced to downgrade every site to 5.7.1. 5.7.2 update breaks things!

  • As far as I can tell in the latest stable version of ACF this is no longer an issue. Whether or not it was the code above or something else I wouldn’t be able to say. I would suggest just downloading the latest stable version though and going with that πŸ™‚

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

The topic ‘Errors in Post Object field ( ACF 5.7.2 )’ is closed to new replies.