How to Display Most Popular Tags in WordPress (2 Easy Methods)

by Montel Anthony
Published: Updated:

Tags are a great way to organize and categorize content in WordPress. Displaying your most popular tags on your site can improve navigation and help visitors discover related content. In this post, we’ll explore two straightforward methods to showcase popular tags – using a plugin and adding code snippets.

Here are some key reasons you may want to feature popular post tags prominently:

  • Improves discovery – Visitors can browse related content by clicking on interest tags
  • Provides insight – Seeing popular tags gives a snapshot of your best content
  • Boosts navigation – Supplements menus and categories for site navigation
  • Looks professional – Popular sites display tags and related content

Now let’s dive into the two easy approaches to display WordPress tags by popularity.

Method 1: Using a Tag Cloud Plugin

Plugins are the fastest way to add a popular tag cloud on WordPress. Here are some benefits:

  • Quick setup – Install and configure in just a few minutes
  • Customization options – Many plugins allow styling the cloud to match your theme
  • Additional features – Some plugins have extras like excluding tags or adding tag counts

There is no shortage of tag cloud plugins, but a top option is WordPress Tag formerly known as TaxoPress.

Installing WP Tag Cloud Plugin

From your WordPress dashboard:

  1. Go to Plugins > Add New
  2. Search for “TaxoPress” and click Install
  3. Activate the plugin after installation
  4. Go to Appearance > Widgets to add and configure

The widget allows choosing cloud formatting like font sizes, colors, alignment and more. You can also select including tag counts and exclude certain tags if desired.

The plugin adds the tag cloud widget you can then place in sidebars, footer widgets, or directly inside posts and pages with the [wp_tag_cloud] shortcode.

More Tag Cloud Plugin Tips

While WP Tag Cloud is a great starting choice, there are many tag cloud plugins with additional functionality:

The best plugin depends on your specific needs. All tag cloud plugins have the advantage of rapid setup compared to coding your own solution. However, going the plugin-free route gives you ultimate control and customization.

Method 2: Adding Tag Cloud Code

If you’re comfortable editing theme code, adding a functions snippet is an efficient way to display popular tags without needing a plugin.

Why Go the Code Route?

Here are the main advantages of using code over a plugin:

  • No dependencies or future compatibility issues
  • Better site performance
  • 100% control over cloud output
  • Matches site design and branding

Let’s look at how to easily add a tag cloud through functions.php.

Adding Tag Cloud Code Snippet

Here are the simple steps to display a popular tag cloud:

  1. Open your active theme’s functions.php file
  2. Add the following code snippet near the end:
function wpb_popular_tags() {
  $tags = get_tags( array(
    'orderby' => 'count',
    'order'   => 'DESC'
  ) );

  $html = '<div class="tagcloud">';

  foreach( $tags as $tag ) {
    $tag_link = get_tag_link( $tag->term_id );
    
    $html .= "<a href='$tag_link' class='tag-link-$tag->term_id'>";
    $html .= $tag->name;
    $html .= "</a>"; 
  }

  $html .= '</div>';
  
  return $html;
}

add_shortcode( 'popular-tags', 'wpb_popular_tags' );
  1. Save functions.php
  2. Add this shortcode anywhere to display [popular-tags]

That retrieves your tags ordered by most used, linking each to their archive page. The .tagcloud wrapper adds basic styling but you can customize CSS to your preference.

Going Further Customizing Your Tag Cloud

The code above outputs an unstyled list of links. Here are some ideas to take it further:

  • Add different font sizes based on tag count
  • Display by ascending/descending count/name
  • Customize colors to match brand
  • Cache output to limit resource usage
  • Exclude certain tags like blog-specific ones
  • Show tag counts next to names

The WordPress tag cloud function has additional parameters to tailor and filter results. The output can also be cached similar to other custom WP functions.

Which Method Should You Use?

Here’s a comparison of the two approaches:

 Using a PluginAdding Code
Learning curveBeginnerIntermediate
SpeedFaster setupBetter performance
CustomizationPlugin options100% flexible CSS/code tweaks
MaintenanceOccasional updatesModify through functions.php

In summary:

  • Plugins – Great for beginners who want quick wins. Limitations depend on plugin.
  • Code – Preferred for advanced users who want fine-grained control. More effort upfront.

Both methods allow showcasing your most popular tags in just a few minutes!

Further Reading

To dive deeper into displaying popular tags, refer to:

Now you know how to feature trending WordPress tags to improve navigation and engagement! Try implementing the plugin method or code snippet on your own site.

Have you shown popular tags on your WordPress site? What approach did you find most effective? Let me know in the comments!

Related Posts

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

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

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.