Using the Basic Loop without
setup_postdata(); as explained in the Relationship Field documentation ended up working.
Here is the code:
<?php $posts = get_field('event_venue'); // Relationship field if( $posts ): ?> <?php foreach( $posts as $p): ?> <td> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> </td> <td> <?php the_field('venue_address', $p->ID); ?> <?php get_field('venue_city', $p->ID); ?><?php if( get_field('venue_state', $p->ID )): ?>, <?php the_field('venue_state', $p->ID); ?><?php endif; ?> <?php the_field('venue_postcode', $p->ID); ?> <?php the_field('venue_country', $post->ID); ?> </td> <?php endforeach; ?> <?php endif; // end our custom Loop within the loop ?>
I guess the question now is why the Basic Loop with
setup_postdata(); doesn’t work? In any event my issue is solved!
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
The ACF site is currently experiencing some issues.— Advanced Custom Fields (@wp_acf) September 21, 2022
We apologize for the inconvenience and we are working hard to get it back up and running as soon as possible.
© 2022 Advanced Custom Fields.