Home Forums Front-end Issues Display Category Custom Field ?


Display Category Custom Field ?

  • Hi there, I was wondering if anyone could help me out!

    I created a new custom field, that belongs to the post category. Nothing special..

    Now, I’d like to echo out all the categories with their extra data on a page..

    I tried this, but it’s not echoing out the extra data does anyone know what i’m doing wrong?

    $taxonomy = 'category';
    $tax_terms = get_terms($taxonomy);
    foreach ($tax_terms as $tax_term) {
    	echo  $tax_term->name . '<br/>';
    	echo 'color: ' . the_field('color', $tax_term->term_id). '<br/>';

    Any hulp is greatly appreciated!
    Thanks in advance!


  • Ok never mind, didn’t read the documentation well enough 🙂

    Was printing the ID instead of category_id 😉

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Display Category Custom Field ?’ is closed to new replies.