Sorting Tag Cloud by Popularity

So I have the default Wordpress Tag Cloud Widget on my sidebar/footer and I found the following code to limit the number that it's showing because it took up a ton of space. This code however is not actually showing the most popular tags, and I don't know what is causing this.

function set_widget_tag_cloud_args($args) {
  $my_args = array(
    'orderby'  = 'count',
    'order'    = 'DESC',
    'number'   = 15
  );
  $args = wp_parse_args( $args, $my_args );
return $args;
}
add_filter('widget_tag_cloud_args','set_widget_tag_cloud_args');

So it is restricting it to 15 tags correctly, but the orderby isn't working properly. For example, my most popular tags (by count) are "Piano" and "Bells" but these are not showing on the list at all. If I run the filter without the 'number' => 15 then the orderby count works properly, but then it shows 45 tags which is too much. Once I add the number arg back into the code it restricts it to 15, but its not displaying them in the right order.

Yellow shows tags across all limits, blue shows what tags are added upon increasing limit, red shows the top tags that don't appear under any limit, only default limit setting.

Topic cloud order count tags widgets Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.