Support

Account

Home Forums Front-end Issues Get Custom Taxonomy Field Value Reply To: Get Custom Taxonomy Field Value

  • This worked for me to get the taxonomy terms for the current post with an ACF icon field attached:

    <?php $terms = get_the_terms( get_the_ID(), 'project_services' );
    $cat_icon = get_field('icon', $queried_object); 
    ?>
    
    <?php if( $terms ): ?>
    <ul class="menu">
    	<?php foreach( $terms as $term ): ?>
    	<li>
    		<a href="<?php echo get_term_link( $term ); ?>">
    			<?php $icon = get_field('icon', $term->taxonomy . '_' . $term->term_id);?>
    			<img src="<?php echo $icon ?>">
    			<?php echo $term->name; ?>
    		</a>
    	</li>
    	<?php endforeach; ?>
    </ul>
    <?php endif; ?>