Edit tag cloud widget number

Add the following to your theme’s function.php. Default values are shown below, except changing ‘number’ from 45 to 15. Only the changed values need to be included, so you can either leave the default values or remove/comment out those lines.

For WordPress Tag Cloud widget:

function custom_tag_cloud_widget() {
$args = array(
‘smallest’ => 8,
‘largest’ => 22,
‘unit’ => ‘pt’,
‘number’ => 15,
‘format’ => ‘flat’,
‘separator’ => “\n”,
‘orderby’ => ‘name’,
‘order’ => ‘ASC’,
‘exclude’ => ”,
‘include’ => ”,
‘link’ => ‘view’,
‘taxonomy’ => ‘post_tag’,
‘post_type’ => ”,
‘echo’ => true
);
return $args;
}
add_filter( ‘widget_tag_cloud_args’, ‘custom_tag_cloud_widget’ );

For WooCommerce Product Tags widget:

function custom_woocommerce_tag_cloud_widget() {
$args = array(
‘number’ => 15,
‘taxonomy’ => ‘product_tag’
);
return $args;
}
add_filter( ‘woocommerce_product_tag_cloud_widget_args’, ‘custom_woocommerce_tag_cloud_widget’ );