Home › Forums › Front-end Issues › Accessing Relationship Field Values Within Relationship › Reply To: Accessing Relationship Field Values Within Relationship
Have you tried just getting the “location” field when looping through the “Producers”?
<h4>Transaction Contacts</h4> <?php $producers = get_field('transaction_contacts'); if($producers): ?> <ul class="list-unstyled"> <?php foreach( $producers as $p) : ?> <?php $office_location = get_field('office_locations', $p->ID); ?> <li> <p><?php echo get_the_title($p->ID); ?></p> <?php foreach( $office_location as $o) : ?> <p><?php echo get_the_title($o->ID); ?></p> <?php endforeach; ?> </li> <?php endforeach; ?> </ul> <?php endif; ?>
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!
We've just released ACF 5.12.3 with a security fix to prevent arbitrary file uploads to forms with ACF fields.— Advanced Custom Fields (@wp_acf) July 14, 2022
Now that we've released this update, we recommend updating your sites as soon as possible.
© 2022 Advanced Custom Fields.