Support

Account

Home Forums General Issues Catchable fatal error

Solved

Catchable fatal error

  • Hi,

    This might have been already asked or reported. basically what I want to do is, I have a custom post type, made with Custom Post Type UI that uses the ACF custom fields. And I have a field a taxonomy field ( select ), that uses an other custom post which act just like categories. But when I try to display this field, it returns a Catchable fatal error.

    the_field('agency');

    Catchable fatal error: Object of class stdClass could not be converted to string in E:\htdocs\wp.andornagy.info\wp-content\themes\twentytwelve\test-page.php on line 31

  • Hi @and0r1995

    The post_object field will return an object. An object in PHP cannot be converted to a string.

    Please use get_field to get the object value, and then display the data from the object as you desire.

    Please read the docs to learn more.

    Thanks
    E

  • And one more question. If i do it like this:

    $agency = get_field('agency');

    How can I display it’s value?

  • Hi @and0r1995

    
    $agency = get_field('agency');
    
    echo get_the_title( $agency->ID );
    

    Please read the WP docs for more info on the $post object.

    Thanks
    E

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

The topic ‘Catchable fatal error’ is closed to new replies.