Support

Account

Home Forums ACF PRO Get ID from relationship field post object

Unread

Get ID from relationship field post object

  • I have a relationship field which returns a post object that is limited to select only one post, I am able to view and see the content I need in the array by using var_dump but I can’t seem to access the ID

    $test_variable = get_field('related_posts', get_the_ID());
    var_dump($sector);

    I’ve tried get_the_ID($test_variable) and $test_variable->ID but both throw errors

    I was wondering if anyone would be able to help

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.