I have over 100 tags on my blog, but in the tag cloud there’s less that 50. I don’t really care about that, but I want to align the widgets in the blog footer, so I need to add 10 or 20 more tags to the cloud. Is there a way to do it?
1 Answer
The tag cloud widget uses wp_tag_cloud()
to display the tags, which defaults to 45 tags.
Source: https://developer.wordpress.org/reference/functions/wp_tag_cloud/
One can use the widget_tag_cloud_args
filter to change this number (and any other arguments passed to wp_tag_cloud()
. Here’s an example:
function wpse_235908_tag_cloud_args( $args ) {
$args['number'] = 70; // the number of tags you want to display.
return $args;
}
add_filter( 'widget_tag_cloud_args', 'wpse_235908_tag_cloud_args' );
You can add this piece of code in a custom plugin or your theme’s function.php file for example.
Note: There’s also a doc reference for the widget_tag_cloud_args
filter, but the documentation is currently wrong as per this core ticket.