Support » Fixing WordPress » Tooltip on widget_tag_cloud_args not working

  • Resolved jd-fb



    I noticed that one of the arugments in the widget_tag_cloud_args is no longer working. I didn’t notice when this stopped working, so it could be that this hasn’t worked in a couple versions of WordPress.

    Specifically, it’s the tooltip that appears when you hover your mouse over a tag in the tag cloud in the front end; it no longer appears because the required HTML isn’t output to the browser.

    Can somebody tell me if this is a bug in WP, or if I’m doing something incorrectly, or need to update my code after a recent WP update?

    Here is my code.

    add_filter ('widget_tag_cloud_args', 'my_tags');
    function my_tags($args){
    	$args['smallest'] = '12';
    	$args['largest'] = '12';
    	$args['format'] = 'flat';
    	$args['separator'] = ', ';
    	$args['orderby'] = 'count';	
    	$args['order'] = 'DESC';
    	$args['topic_count_text_callback'] = 'my_tag_tooltip';
    	// The arg above is the one that seems to have stopped working.
    	return $args;	
    function my_tag_tooltip($count){
    	return sprintf( _n( '%s blog post with this tag', '%s blog posts with this tag', $count ), number_format_i18n( $count ) );
Viewing 3 replies - 1 through 3 (of 3 total)
  • As of 4.8 the Tag Cloud no longer uses the title attribute for counts. It uses the aria-label attribute instead, which doesn’t generate a tooltip.

    You can read about the reasoning here:

    Thread Starter jd-fb


    That makes total sense! Thanks @jakept! I’ll update my filter with this new info.

    Thread Starter jd-fb


    Actually, can I ask one more thing?

    Out of curiosity, I looked at the WP core files, specifically /wp-includes/category-template.php, and the file still refers to $args['topic_count_text_callback']. I understand that its use was deprecated in version 4.8, but shouldn’t its reference be deleted from the core files?

    (I think that’s what confused me and got me to ask the question in the first place.)

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Tooltip on widget_tag_cloud_args not working’ is closed to new replies.