Do you want to display the most popular tags used on your WordPress site?

Tags and categories are the two default ways that you can use to sort your content in WordPress. However, categories often attract more attention due to their broader scope, leaving tags with less exposure.

In this article, we will show you how to easily display your most popular tags in WordPress.

Categories and tags are the two default taxonomies used 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.

For example, you might use the ‘travel’ category for all your travel-related blog posts, with tags like ‘Europe’, ‘Asia’, and ‘South America’.

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 remain less explored by your visitors.

One way to display tags on your website is by adding the default Tag Cloud block by visiting the Appearance » Widgets page.

However, you will notice that this block will show all your tags alphabetically. You cannot rearrange their order or limit the number of tags that are displayed.

You can solve this by displaying the most popular or most often used tags on your WordPress blog. This will allow your users to quickly get an idea of the frequently discussed topics on your site. It will also help them discover more content, which means more page views and user engagement.

Additionally, this can improve your website SEO because tags can give search engines a better understanding of the topics your website covers, helping your content rank higher.

Having said that, let’s take a look at how to easily display your most popular tags in WordPress. We will cover different methods, and you can use the quick links below to jump to the one you want to use:

If you want to use a plugin to display the most popular tags on your website, then this method is for you.

First, you need to install and activate the TaxoPress plugin. For detailed instructions, you may want to see our step-by-step guide on how to install a WordPress plugin.

Upon activation, visit the TaxoPress » Terms Display page from the WordPress dashboard. Here, you need to click on the ‘Edit’ link under the ‘Terms Display’ option.

This will open a new page on the screen, where you can start by choosing a title for displaying tags. After that, make sure that the ‘Tags’ option is selected in the ‘Taxonomy’ dropdown menu.

Then, you can pick if you only want to display tags that are used on your pages, posts, or media separately. Alternatively, you can display popular tags for all the post types.

We recommend using the ‘Posts’ option. This will automatically eliminate any tags that you have used for your pages or images.

Next, switch to the ‘General’ tab from the left column and choose the ‘Counter’ option from the ‘Method for choosing terms from the database’ dropdown menu.

Next, simply select the ‘Descending’ option from the ‘Ordering for choosing term from the database’ menu.

Once you do that, you must pick the ‘Counter’ option again from the ‘Method for choosing terms for display’ dropdown menu and the ‘Descending’ option from the ‘Ordering for choosing terms for display’ dropdown menu.

Now, only the most popular tags on your WordPress site will be displayed.

Once you do that, switch to the ‘Options’ tab from the sidebar.

Here, you can add any text that you want to display before or after your list of popular tags.

After that, switch to the ‘Design’ tab and choose the maximum number of popular tags to display on your website.

You can also choose a font size and colors for your tags. Then, go ahead and click the ‘Save Terms Display’ button on the right.

Add Popular Tags to the WordPress Sidebar

Now, head to the Appearance » Widgets page from the WordPress admin sidebar and click the ‘Add Block’ (+) button.

Note: If you are using a block theme, then this method won’t work because the TaxoPress plugin doesn’t offer the ‘Terms Display’ block in the full site editor. In this case, you can use our second method.

This will open the block menu, where you can add the Terms Display block to your website sidebar.

Once you do that, just select the term display that you created for your tags from the dropdown menu within the block itself.

Finally, click the ‘Update’ button at the top to store your settings.

Now, you can visit your WordPress site to view the list of popular tags in action.

If you are using a block theme or prefer to use code, then this method is for you.

You can display the most popular tags in WordPress by adding custom code to your theme’s functions.php file. However, the smallest error when typing the code can make your website inaccessible.

That is why we recommend using WPCode. It is the best WordPress code snippets plugin on the market that makes it safe and easy to add code to your website.

First, you need to install and activate the WPCode plugin. For more information, see our beginner’s guide on how to install a WordPress plugin.

Note: WPCode has a free plan that you can use for this tutorial. However, upgrading to the paid plan will unlock more features like conditional logic, CSS snippets, a code snippets cloud library, and more.

Upon activation, head to the Code Snippets » + Add Snippet page from the WordPress dashboard.

Here, click the ‘Use Snippet’ button under the ‘Add Your Custom Code (New Snippet)’ option.

This will direct you to the ‘Create Custom Snippet’ page, where you can start by adding a name for the snippet.

Next, choose the ‘PHP Snippet’ option as the Code Type from the dropdown menu on the right.

After that, copy and paste the following custom code into the ‘Code Preview’ box:

function wpb_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('wpb_popular_tags', 'wpb_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 the number of posts in each tag. After that, it creates a shortcode wpb_popular_tags and enables a shortcode in the text widget.

Now, you have to scroll down to the ‘Insertion’ section and choose the ‘Auto Insert’ mode. The code will be automatically executed once you add the built-in shortcode to your website.

Once you do that, scroll back to the top and toggle the ‘Inactive’ switch to ‘Active’.

Finally, click the ‘Save Snippet’ button to store your settings.

Add Most Popular Tags in the WordPress Full Site Editor

If you are using a block theme, then head to the Appearance » Editor page from the WordPress dashboard.

This will open the full site editor, where you have to click the ‘+’ button to open the block menu. From here, add the Shortcode block to the page.

Next, you must add the following shortcode to the block itself:

[wpb_popular_tags]

Finally, click the ‘Save’ button at the top to store your settings.

Now, just visit your website to see the popular tags in action.

Add Most Popular Tags in the WordPress Widget Area

If you are using a classic theme on your website, then you can add popular tags by visiting the Appearance » Widgets page from the WordPress dashboard.

Here, click the ‘Add Block’ (+) button to open the block menu and add the Shortcode block to your preferred widget area.

Next, add the following shortcode into the block:

[wpb_popular_tags]

Then, click the ‘Update’ button to store your settings.

Now, go ahead and visit your WordPress site to see the popular tags.

Bonus: Style the Tags on Your WordPress Website

Now that you have added the most popular tags to your WordPress website, it is also important to customize them for the theme that you are using. This will make your tags visually appealing and help grab the user’s attention immediately.

Plus, by using different sizes, fonts, and colors for your tags, you make it easier for visitors to scan and find the tags they are interested in. This can help increase engagement and click-through rates.

For example, if a user is only interested in reading about your articles related to travel, then they can click on that tag to open a list of travel-related articles.

You can style your tags by adding custom CSS to change the spacing between them, add background colors, change the alignment, and much more.

For detailed instructions, you can see our beginner’s guide on how to style tags in WordPress.

We hope this article helped you learn how to display the most popular tags in WordPress. You may also want to see our beginner’s guide on categories vs. tags – SEO best practices for sorting your content and our list of most wanted WordPress tips, tricks, and hacks for beginners.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.


source

Categorized in: