Post Image

How to Display Most Popular Tags

Do you want to display the most popular tags used on your WordPress site? Tags and categories are the two default ways to sort your content in WordPress. Categories often get more exposure due to their broader scope, which gives tags a little less attention. In this article, we will show you how to easily display your most popular tags in WordPress.

Why and When You Should Display Most Popular Tags in WordPress

Categories and tags are the two default taxonomies to sort your articles in WordPress. Categories are used for broader topics or sections on your website while tags are well-suited to specific ideas within the context of your articles.

Often beginners end up using them incorrectly, but there are easy tools which allow you to merge categories and tags and even convert them.

Once you start using categories and tags correctly, you’ll likely have more tags on your website than categories. Due to their broader scope, you can put categories in navigation menus, but your tags may often remain less explored.

One way to deal with this is by adding the default tag cloud widget by going to the Appearance » Widgets page, and add Tag Cloud widget to a sidebar.

Default tag cloud widget in WordPress

However, you will notice that the default tags widget will show all your tags alphabetically. You cannot rearrange their order or limit the number of tags to be displayed.

You can solve this, by displaying the most popular or most often used tags on your WordPress site.

This will allow your users to quickly get an idea on what topics are more frequently discussed on your site. It will also help them discover more content, which means more page views and user engagement.

Now let’s take a look at how to easily display your most popular tags in WordPress.

Display Popular Tags in WordPress

This method requires you to add code in your WordPress theme files. If you haven’t done this before, then please see our guide on how to copy and paste code in WordPress.

First, you need to add this code to your theme’s functions.php file or a site-specific plugin.

function br_tag_cloud() {
  $tags = get_tags();
  $args = array(
    'smallest'    => 10,
    'largest'     => 22,
    'unit'        => 'px',
    'number'      => 10, 
    'format'      => 'flat',
    'separator'   => " ",
    'orderby'     => 'count',
    'order'       => 'DESC',
    'show_count'  => 1,
    'echo'        => false
  $tag_string = wp_generate_tag_cloud( $tags, $args );

  return $tag_string;

// Add a shortcode so that we can use it in widgets, posts, and pages
add_shortcode('br_popular_tags', 'br_tag_cloud');

// Enable shortcode execution in text widget
add_filter ('widget_text', 'do_shortcode');

This code simply generates the top 10 tags from your website in a cloud with number of posts in each tag. After that it creates a shortcode br_popular_tags and enables shortcode in text widget.

You can now add shortcode [br_popular_tags] in any post, page, or widget to display your most popular tags.

In conclusion

We hope this article helped you learn how to display most popular tags in WordPress. Increase count of your customers, improve your site with ours guides. Be better!