Support

Account

Home Forums General Issues Return value of Post Object field ?

Solved

Return value of Post Object field ?

  • Hi,

    what im trying to do is the reverse Relationship querying like in the “Querying relationship fields” example single-locations.php

    But i dont want to use a relationship field, i want to use the Post Object field with a simple dropdown.

    But you cant specify a return value for the Post Object field, so the query does not work, since it requires the ID and not the whole Object.

    Is there a solution for this? Maybe you could add this in a future release.

  • Hi @n1smo

    ACF will only ever save the ID into the DB, never the object. The return format is something that is run AFTER loading the DB value.

    In short, yes you can follow the relationship tutorial, however, if your post_object field saves 1 single value (no a multi-select), then you do not need to use a LIKE compare, you can simply look for posts with the custom field value of $post_id

    Thanks
    E

  • Ah ok,

    makes sense.

    Thanks you!

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

The topic ‘Return value of Post Object field ?’ is closed to new replies.