i have a loop for custom post type and i want to get a field from other post connected with relationship but due to that main loop is wp-query i can’t get this field using loops from relationship page documentation with or without setup_postdata.
Is there a way to make it working?
a relationship field can be set up to return post objects. The field should be returning a list of posts and you can access the values of those posts without have_posts. Each post in the returned array will have, in your case, $p->ID, which is the ID of the post. Using that ID you can get the value of an ACF field or other information about that post without the need of a have_posts() loop.
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users