I need to get post popular tags. Here what I found from https://codex.wordpress.org/Function_Reference/wp_tag_cloud

$tag = wp_tag_cloud( 'smallest=8&largest=22&number=2&orderby=count&format=array' );

Here is an example from Wordpress site:

Cloud displayed under Popular Tags title

<?php if ( function_exists( 'wp_tag_cloud' ) ) : ?>    
<h2>Popular Tags</h2>
<li><?php wp_tag_cloud( 'smallest=8&largest=22' ); ?></li>
<?php endif; ?>

I did not understand this parameters meaning smallest=8&largest=22 and does this example what I need?

  • 2
    smallest and largest are maximum font size that a tag can have based on it's popularity (usage). The largest tag in output on website means most popular tag. And yes, it will work. Use it and you will know.
    – Robert hue
    Commented Oct 6, 2015 at 6:03
  • How you want to determine the popularity of posts? I have two suggestions here: either you can consider post comment count or the number of views as a criteria. Then you can fire a query to get tags of posts having more comments or views. Commented Oct 6, 2015 at 6:20
  • @ItsMePN I think he is asking about popular post tags not popular posts.
    – Robert hue
    Commented Oct 6, 2015 at 6:59

1 Answer 1


It is the max and min font size for most popular and least popular tags. If you are just want to display the popular tags and not the cloud then you can use the format option to display as an unordered list.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.