i am trying to show a field that i have added to custom post type category (taxonomy). the taxonomy called "category-products". i have added a field called "category_image" in which i want to add an image. But the acf field is not showing the value. here is what I have tried so far.
<?php
$taxonomy = 'category-products';
$terms = get_terms($taxonomy);
if ( $terms && !is_wp_error( $terms ) ) :
?>
<ul>
<?php foreach ( $terms as $term ) { ?>
<li class="cate col-md-2">
<a href="<?php echo get_term_link($term->slug, $taxonomy); ?>"><?php echo $term->name; ?>
<?php the_field('category_image', $terms ); ?>
</a></li>
<?php } ?>
</ul>
<?php endif;?>
the_field
. The second parameter should be the post id, but you are passing in the array of WP_Terms – FluffyKitten