# Tag Cloud Widget: Most Popular Tags Only

> Limits the Tag Cloud widget and block to your most used tags and orders them by popularity, so the cloud stays readable on sites with hundreds of tags.

- Type: PHP
- Runs: Run everywhere
- Category: [Widgets](https://wpide.com/library/category/widgets/)
- Tags: widgets, tags, tag-cloud
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/tag-cloud-widget-popular-only/

## Code

```php
// Number of tags to show.
$wpide_tag_cloud_number = 20;

add_filter( 'widget_tag_cloud_args', function ( $args ) use ( $wpide_tag_cloud_number ) {
    $args['number']  = absint( $wpide_tag_cloud_number );
    $args['orderby'] = 'count';
    $args['order']   = 'DESC';

    return $args;
} );
```

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Tag Cloud Widget: Most Popular Tags Only" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
