Support

Account

Home Forums General Issues Post Object field return type changes depending on use.

Unread

Post Object field return type changes depending on use.

  • I am having a bit of trouble.

    I have a Field (of type ‘Post Object’), to create a link between an ‘article’ and a ‘contributor’ (both Custom Post Types). I have tested with the return type being set to both ‘Post Object’ and ‘ID’, but it doesn’t seem to make a difference.

    For testing purposes I use the following:

    $my_post_object = get_field("post_object');
    print_r($my_post_object);
    

    When used within a WP_Query, the returned value is a string – the ID of the post. however, when I use the same code on the ‘single-article.php’ template, a full Post Object is returned…

    Why would this be the case, and how can I get consistency?

Viewing 1 post (of 1 total)

The topic ‘Post Object field return type changes depending on use.’ is closed to new replies.