WordPress

WordPress Tag Cloud Widget Limit

If your WordPress website has a lot of tags (and it’s growing), you can probably struggle with the messy list that looks bad in the WordPress tag cloud widget. However, you would rather show the decreasing number of tags instead of removing the widget, right?

Add the following code to your functions.php file:

add_filter('widget_tag_cloud_args', 'tag_widget_limit');
function tag_widget_limit($args){
if(isset($args['taxonomy']) && $args['taxonomy'] == 'post_tag'){
$args['number'] = 10;
}
return $args;
}

To change the limit $args[‘number’] = 10; change the code.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top