How to change tag tooltip to tag Description?
I tried and my code is mentioned below.
function title_text( $description ) {
return sprintf( _n('%s topic', '%s', $description), $description );
}
wp_tag_cloud( array( 'topic_count_text_callback' => 'title_text') );
This is not working. Can any one please check this code and find me a correct solution?
The argument
topic_count_text_callback
cannot do what you need, because it doesnât get the term ID and the taxonomy as arguments. This should be fixed in core.I think I will write a patch for that later.Update: I have written a patch for Ticket #21198. The milestone is 3.6, so the following answer will be out of date eventually. I will update this post then.
But not all hope is lost. We can filter the generated markup on
wp_tag_cloud
, run a regex on that and extract the term ID from theclass
attribute and the taxonomy from the second parameter$args
. Then we use the term ID and the taxonomy to get the term description and replace the original title attribute.Result