How to Change WordPress Tag Cloud Tag Number

The title might be mouthful, but WordPress’ embedded tag cloud widget has a default limit on how many tags it will display. The widget does not update automatically based on the space, —yes, I was surprised to find out about it too— and the maximum number of tags the widget displays is set as a variable as far as I am aware.

You can easily alter the variables inside the tag cloud widget, by adding the following function to the functions.php of your theme file. Don’t forget to replace the NUMBER in the function to the number of your liking.

// Change Tag Cloud Numbers (NUMBER)
function tag_cloud_numbers_args( $args ) {
    $args['number'] = NUMBER;
    return $args;
}
add_filter( 'widget_tag_cloud_args', 'tag_cloud_numbers_args' );

The widget will now display the number of tags you have specified. Tag clouds do take more arguments, so there are rooms for customization. Here is the documentation from WordPress. There are also better (i.e. smarter) tag cloud plugins. I opted to use the good ol’ default widget, because most of the readers either opt to use Google Search or the search feature on the website.

Leave a comment