Skip to content

Using Tags Effectively in WordPress

Tags are a great way of associating the same type of content together, and they’re something that many bloggers use regularly, but using them effectively? That’s what this post will tell you how to do.

Using the same tags

Tags only really work if you use the same tags over and over again. For example, if you wrote a post about cheese, you might tag it ‘Cheese’. Write a second post about cheese, tag it ‘Cheeses’ and the tags become useless. Bascially, you must tag similar posts with the same tag.

Putting this in real terms: on my other site,, each post gets tagged with the game it is related to:

And as you can see, you’re left with a rather nice tag cloud. Had some games been tagged ‘Assassin’s Creed’ whilst others ‘Assassins Creed’, you wouldn’t get the same look. Heck, it’d look like the one here on [wp]!

Implementing the tags

Within the loop

With tags made, you’ve now got a number of options for implementing the tags. Used within the loop, you can display tags with the template tag

 <?php the_tags( $before, $separator, $after ); ?>

Obviously, this is going to output the current post’s tags, with options for text before, between and after. Say you wanted to have ‘Tagged: tag 1, tag 2, tag 3.’ You’d need the code:

<?php the_tags('Tagged: ',', ','.'); ?>

With all the commas that looks slightly unclear, but look at it this way and it’s a bit clearer: each section is in quotation marks ‘ ‘ , with a comma ‘,’ between the sections.

Outside the loop

Outside of the loop, you can display a rather lovely tag cloud. The good news is that it’s really easy to do. The easiest way is through widgets: if your theme is widgetised, under Widgets you can drag and drop the tag cloud widget, give it a title and save it. You’ll then have a nice tag cloud. Simple.

Of course, this wouldn’t be a [d] blog if we just left it with widgets! Lets achieve the same thing with the template tag:

<?php wp_tag_cloud(); ?>

Of course, by using a template tag, you’ve got the added advantage of being able to customise – as the codex shows, the tag has a ton of options:

smallest – The smallest tag (lowest count) is shown at size 8
largest – The largest tag (highest count) is shown at size 22
unit – Describes ‘pt’ (point) as the font-size unit for the smallest and largest values
number – Displays at most 45 tags
format – Displays the tags in flat (separated by whitespace) style
orderby – Order the tags by name
order – Sort the tags in ASCENDING fashion
exclude – Exclude no tags
include – Include all tags
link – view
taxonomy – Use post tags for basis of cloud
echo – echo the results

The ones that we’re interested in are ‘smallest’ and ‘largest’ – they let you choose the minimum and maximum number of entries a tag must have in order to be displayed. Say I wanted a minimum of 2 and a maximum of 10, I’d need the following:

<?php wp_tag_cloud('smallest=2&largest=10'); ?>


And with that, we’re done. Hopefully you’ve not got a solid understanding of how tags work and how you can implement them effectively into your WordPress [theme].

Alex Denning

Most Voted
Newest Oldest
Inline Feedbacks
View all comments
October 6, 2010 9:16 pm

Out of loop use of tags without widgets was just what I needed…worked great for me, thanks.

Bill Ludwig
September 19, 2009 4:29 am

Nice post, especially the part about keeping the same tags. I always try to use the singular form and present tense. That rule of thumb helps when I’m using a CMS that doesn’t implement tags as well as WordPress.

Using Tags Effectively in WordPress | ShareFavorite
September 18, 2009 5:26 pm

[…] posted here: Using Tags Effectively in WordPress Related […]

Or start the conversation in our Facebook group for WordPress professionals. Find answers, share tips, and get help from other WordPress experts. Join now (it’s free)!

Most Searched Articles

Best JavaScript Libraries and Frameworks: Try These 14 in 2024

In this post, we look at the best JavaScript libraries and frameworks to try out this year. Why? Well, with JavaScript being available in every web browser, this makes it the most accessible programming language of ...

25 Best Free WordPress Themes (Responsive, Mobile-Ready, Beautiful)

If you're looking for only the best free WordPress themes in the market for this year, then you're in the right place. We have more than enough such themes for you right ...

12 Best WordPress Hosting Providers of 2024 Compared and Tested

Looking for the best WordPress hosting that you can actually afford? We did the testing for you. Here are 10+ best hosts on the market ...

Handpicked Articles

How to Make a WordPress Website: Ultimate Guide for All Users – Beginners, Intermediate, Advanced

Many people wonder how to make a WordPress website. They’ve heard about WordPress, its incredible popularity, excellent features and designs, and now they want to join the pack and build a WordPress website of their own. So, where does one get ...

How to Start an Ecommerce Business: Ultimate Guide for 2024

Is this going to be the year you learn how to start an eCommerce business from scratch? You’re certainly in the right place! This guide will give you a roadmap to getting from 0 to a fully functional eCommerce business. ...