WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

I thought this would have displayed the post counts right next to the clickable links

array( 'taxonomy' => $taxonomy, 
'format' => 'list', 
'smallest' => 12,  
'largest' => 12, 
'number' => 10000 , 
'separator' => '<li>' ,  
'topic_count_text_callback'=> 'default_topic_count_text' ) 

but, it ends up displaying this;

item 1 
item 2 
item 3 

What's the trick to make it display something like this?

item 1 (100)
item 2 ( 90 )
item 3 (15 )

I tried the following codex code, but that caused no visible change.

wp_tag_cloud( array( 'topic_count_text_callback' => 'my_tag_text_callback' ) ); 

function my_tag_text_callback( $count ) {
 return sprintf( _n('%s picture', '%s pictures', $count), number_format_i18n( $count ) );
share|improve this question

You'll have to use the get_terms function to build your own list if you want the count in there.

If we read the details of topic_count_text_callback we can see why it may appear to not be working:


(string) (optional) The function, which, given the count of the posts with that tag, returns a text for the tooltip of the tag link. Default: default_topic_count_text

this function sets the link's title attribute text, it doesn't show the count with the term directly in the text. If you hover over the links you'll see the text pop-up in a tooltip next to your cursor.

share|improve this answer
Milo, I checked the wp_tag_cloud's output. In the title attribute of the outputted html, I see the count! Ex: title='8 topics' Can something be done with that info without invoking another function? – Average Joe Jun 11 '12 at 22:15
$tax_list = wp_list_categories( array( 'taxonomy' => 'YOUR-CUSTOM-TAXONOMY', 'orderby' => 'name', 'show_count' => 1, 'pad_counts' => 0, 'hierarchical' => 1, 'echo' => 0 ) );

Echo $tax_list that to the browser and you're done.

share|improve this answer
Please explain why that could solve the problem. – toscho Feb 19 '13 at 16:52

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.