WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to show a list of custom taxanomy terms assigned to the current post type with a name and a custom field. (Created with Advanced Custom Fields)

Currently I use the following code, to show a list of the custom taxanomy terms assigned to the current post:

echo '<ul class="taxanomy-name">';
echo get_the_term_list( $post->ID, 'taxanomy-name', '<li>', ',</li><li>', '</li>' );
echo '</ul>';

Allthough I want to show a custom field from each taxanomy term along with the name. The code for showing the custom field on each taxanomy term page template is:

the_field('custom-field-name', 'taxanomy-name_ID');

My question is, how do i show the custom field, along with the custom taxanomy term name on the list?


  Taxanomy Term Name 1
  <img src="custom-taxanomy-term-1-custom-field-image">

  Taxanomy Term Name 2
  <img src="custom-taxanomy-term-2-custom-field-image">

I hope you can help me.. It's been bugging me for hours. Thanks!

share|improve this question
up vote 1 down vote accepted

Use the get_the_terms function instead so you can build the list manually and access the term_id for each term.

$terms = get_the_terms( $post->ID, 'taxanomy-name' );
echo '<ul>';
foreach( $terms as $term ):
    echo '<li>';
    echo $term->name;
    the_field( 'custom-field-name', 'taxanomy-name_' . $term->term_id );
    echo '</li>';
echo '</ul>';
share|improve this answer
Thank you very much Milo - That did the trick! – Mikkel Tschentscher Jan 27 '13 at 16:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.