Skip to main content

Show list of taxonomy terms for a specific post in WordPress

Have you set up custom taxonomies in WordPress and want to display all of the terms that a post has on it’s single page? No problems, paste the below code into your template.
Don’t forget to change YOURTAXONOMYNAME with the slug name of your taxonomy.

// tag links in template

$post_id = get_the_ID();
$tags = get_the_terms($post_id,'YOURTAXONOMYNAME');

foreach ($tags as $tag){

$link = get_term_link($tag->term_id);

echo '<a href="'.$link.'">'.$tag->name.'</a>';

Leave a Reply