Displaying the taxonomy name

WordPress Code Snippet

Sometimes you want to display the taxonomy value for post type and this next bit of code will do just that. Just put this where you want the value to appear in your WordPress themes template file and it will bring back the taxonomy category name. This snippet can go in single.php, archive.php etc and must be within the WordPress loop.

$terms = get_the_terms( $post->ID , 'yourtaxonomyname' );
foreach ( $terms as $term ) {
echo $term->name;