How To Display Most Popular Tags In WordPress Using the WP_TAG_CLOUD Function

I’m sure there are many people out there like me who started off displaying the default number of tags on their WordPress 2.3+ blogs. After a month or so of posting, you maybe have starting realizing that tags are like cats; uncontrolled, they can just keep multiplying over time and crowding out the spaces where they live;-)

The default setting for the wp_tag_cloud function is 45 tags. But for many WordPress themes, this number is too large for the space allocated to your tag cloud. The good news is that there is an easy way to trim down the total number of tags that get shown.

Here’s the code to display the 30 most popular tags on your blog, with the smallest font size at 8 and the largest font size at 22:

If you want to show more or less tags, just change the number 30 to whatever you want. If you want the most popular tags to look bigger, just increase the number 22 to whatever you want. If you want the least popular tags to look smaller, just change the 8 (but don’t go too small or else no one will be able to read).

So all you need to do to contain tag sprawl, is to spay or neuter your wp_tag_cloud function with the “number” variable.

3 thoughts on “How To Display Most Popular Tags In WordPress Using the WP_TAG_CLOUD Function

Comments are closed.