Home › Forums › General Issues › get_the_terms() don't retrieve custom fields › Reply To: get_the_terms() don't retrieve custom fields
You need to loop the taxonomies and in doing so, get the taxonomy ID
Once you have that, you can access the custom fields you store against the taxonomy.
Something like:
<?php if( $contacts = get_terms( array( 'taxonomy' => 'contact' ) ) ) :
foreach( $contacts as $contact ) :
$email_du_contact = get_field('email_du_contact', 'term_' .$contact->term_id );?>
<?php echo $email_du_contact; ?>
<?php endforeach;
endif;
?>
Code untested
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 use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.