Don’t show a tag on a post if it is the only post with that tag


At the bottom of a post, I show all that tags that post has.

If the current post is the only post with tag X, then I don’t want tag X to show in the list. Because if someone clicks on that, they’ll be taken to an archive page where the post they were just looking at is the only post listed. Useless.

Otherwise I don’t have a problem with tags that only have one post.

It’s a custom post type with custom taxonomies (three different taxonomies: topic, name, simile)

Here is how I am displaying the topic taxonomy:

<p class="meta-tag-list"> 
echo get_the_term_list( $post->ID, 'topic',
'', ' ', '' );
?>  </p>

Does a function already exist that would let me do this?

HopefullCoder 3 years 2020-03-31T00:51:15-05:00 0 Answers 65 views 0

Leave an answer