Display Taxonomy in post loop in ACF Relationship field

Marko Krstić
26 Jan 2020
<?php $terms = get_the_terms( $p->ID, 'product_cat' );
	foreach ($terms as $t) {
	echo $t->name, ' ';
} ?>

Product cat is category name for WooCommerce products category.

Thanks, Hammad Wali for sharing this useful code!

Was this article helpful?



Never miss new post again

Subscribe and get list of new posts in your inbox

Click to Copy