WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So I had to fiddle allot with tag cloud to display it correctly. My script limits display to 5, and since I don't display all tags, I'd like wp to output list in descending order based on popularity. So if tag has most posts it will be displayed first, and so on... Is this possible? I have a hunch I've to modify get_the_tags(), but not sure how as of now... any help appreciated! :)


                    while (have_posts()) : the_post();

                    $posttags = get_the_tags();
                    if ($posttags) {
                        foreach($posttags as $tag) {
                            echo '<li><a href="'.get_tag_link($tag->term_id).'">'.$tag->name.'</a></li> ';
                            if( $counttag >5 ) break;


share|improve this question
nobody? really? – Sandro Dzneladze Sep 23 '11 at 14:48
WordPress has function wp_tag_could() maybe you should try output tag cloud with it – Mamaduka Sep 24 '11 at 13:50
wp_tag_could() I cannot make it target particular post. it rather outputs all /most popular tags from the whole blog. I want post specific tags to be displayed. – Sandro Dzneladze Sep 26 '11 at 14:11
up vote 0 down vote accepted

This is a little bit more complicated than I thought.

But I did find this link Which should help you on your path. Minus the custom post types, the code should be what you are looking for.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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