How to control WordPress 9.2 tag cloud font size?

We all know that WP has added widget_tag_cloud_args filter, you can use this function to override the default arguments that are passed to the wp_tag_cloud function to change the tag cloud font size you like. This filter provides a keyed array, where the smallest, largest, and unit keys represent the smallest font size, the largest font size, and the unit (‘pt’, ‘em’, ‘px’, etc) used by the default tag cloud widget.

Sometimes we want to change the tag cloud font size to meet our demands. How to do then? We can change the minimum and maximum font size that the default tag cloud widget uses in WordPress by creating a new plugin that hooks that filter as explained below.

Create a new .php page called kingphp-tag-cloud.php. Copy and paste the following code into that text file, changing the relevant values (shown in bold) as you desired, and save it.

$args['largest'] = 18;
$args['unit'] = 'pt';
return $args;

add_filter('widget_tag_cloud_args', 'kingphp_tag_cloud_filter', 90);

Create a new directory called kingphp-tag-cloud in your wp-content/plugins directory, and upload kingphp-tag-cloud.php to the new directory. Finally, activate the plugin by logging into WordPress as an administrator, selecting Plugins from the menu, and selecting Activate for the KingPHP Tag Cloud plugin.

King Php Science Welcome, you are from: