3

I'm looking to modify my theme so that only tags that have been used more than once show up on the site.

Here's my logic, feel free to fault any (and all) of it:

  1. There is no point in only using tags once. All the tag will do is link to a tag archive with one post.
  2. However, I'd still like to tag my first post about unicorns with unicorn.
  3. That way, when I post about unicorns for the second time, the tag will suddenly appear on both posts.

I know a bit about WordPress and how it works, but not enough to do this. Should it be a plugin? Is there a function option/parameter/thing I've missed that does this? I seem to remember a database field that counts the number of times a tag is used, how does that help?

Thanks!

1 Answer 1

1

The filter term_links-post_tag passes …

'<a href="' . $link . '" rel="tag">' . $term->name . '</a>'

… as its only argument. You could extract the term name, count the associated posts and return an empty string if there is only one post. the_tags() will not print it then.

Very hackish, maybe someone else will find a better solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.