Tags Without Links

In a few recent client projects, I’ve had the need to display WordPress tags without links. Sure, this is relatively easy to do with a foreach loop, but I got tired of writing the same code.

So I decided to write a simple plugin that makes it way to display the tags without links.

WordPress Tags Without Links

Just as the GitHub repository homepage reads:

This plugin makes it easier for developers to display WordPress tags without links associated with them.

The purpose of the plugin is to provide developers an easy way to render tags without the tags actually having been linked. It also uses the standard conventions for WordPress functions:

  • the_tags_without_links will echo the list of tags associated with the given post using the default separator (which is a space)
  • get_the_tags_without_links will return the list of tags associated with the given post using the default separator, but will not echo it to the current template
  • Both functions also accept an optional parameter for defining your own separator

It’s simple, but I’ve used it in enough projects that I’ve found it useful, so I thought it made sense to release it as a plugin.

The plugin is obviously open source, is not available in the WordPress Plugin Repository, and is open for contributions. Check out the README, grab the current version from GitHub and feel free to contribute, as well.


Join the conversation! 6 Comments

  1. Nice! I’ve needed this for clients as well and even though it’s no deal trouble to implement, I do believe this belongs in the core.

    Since the introduction of custom post types, posts have been used for more than articles and static pages, which had caused terms to be used more for stating attributes of content, opposed to before, when the main taxonomy (the category) was used for categorizing. This results in the use of listing terms as attributes without there being an archive for them.

    So: core material! However, as it’s no core contribution but a plugin, why I are you not prefixing the functions? There is a reasonable chance that a function for this will be in core sooner or later. You’re not checking whether the function exists (which could also be an approach) so when this function is implemented in the WordPress core it will break. Prefix all your plugin data in any shared context. Please :-).

    • However, as it’s no core contribution but a plugin, why I are you not prefixing the functions?

      A good point! Will be taking care of that this morning and will have it deployed on GitHub soon.

      Thanks for catching that :).

      • Ouch, this one hurts! There’s all sorts of reasons not to use certain prefixes, but one of them is really out of the picture when declaring your own functions… Surprise surprise, it’s wp_!

        The wp_ prefix is reserved (though not enforced) for WordPress core functions and it’s very, very bad practice to use it to prefix your plugin’s functions.

        I would suggest using a prefix such as twl_, abbreviating Tags without links or something similar. Anything, really, but wp_ :-).

  2. What I added was

  3. OK got it! not wp_get_the_tags_without_the_links(); but twl_the_tags_without_links(‘, ‘);

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.