Title: wp_tag_cloud
Published: April 25, 2014
Last modified: May 20, 2026

---

# apply_filters( ‘wp_tag_cloud’, string|string[] $return, array $args )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/hooks/wp_tag_cloud/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/wp_tag_cloud/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/wp_tag_cloud/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/wp_tag_cloud/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/hooks/wp_tag_cloud/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/hooks/wp_tag_cloud/?output_format=md#wp--skip-link--target)

Filters the tag cloud output.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/wp_tag_cloud/?output_format=md#parameters)󠁿

 `$return`string|string[]

Tag cloud as a string or an array, depending on `'format'` argument.

`$args`array

An array of tag cloud arguments. See [wp_tag_cloud()](https://developer.wordpress.org/reference/functions/wp_tag_cloud/)
for information on accepted arguments.

More Arguments from wp_tag_cloud( … $args )

Array or string of arguments for generating a tag cloud.

 * `smallest` int
 * Smallest font size used to display tags. Paired with the value of `$unit`, to
   determine CSS text size unit. Default 8 (pt).
 * `largest` int
 * Largest font size used to display tags. Paired with the value of `$unit`, to 
   determine CSS text size unit. Default 22 (pt).
 * `unit` string
 * CSS text size unit to use with the `$smallest` and `$largest` values. Accepts
   any valid CSS text size unit. Default `'pt'`.
 * `number` int
 * The number of tags to return. Accepts any positive integer or zero to return 
   all.
    Default 0.
 * `format` string
 * Format to display the tag cloud in. Accepts `'flat'` (tags separated with spaces),`'
   list'` (tags displayed in an unordered list), or `'array'` (returns an array).
   
   Default `'flat'`.
 * `separator` string
 * HTML or text to separate the tags. Default "n" (newline).
 * `orderby` string
 * Value to order tags by. Accepts `'name'` or `'count'`.
    Default `'name'`. The
   ['tag_cloud_sort'](https://developer.wordpress.org/reference/hooks/tag_cloud_sort/)
   filter can also affect how tags are sorted.
 * `order` string
 * How to order the tags. Accepts `'ASC'` (ascending), `'DESC'` (descending), or`'
   RAND'` (random). Default `'ASC'`.
 * `filter` int|bool
 * Whether to enable filtering of the final output via ['wp_generate_tag_cloud'](https://developer.wordpress.org/reference/hooks/wp_generate_tag_cloud/).
   Default 1.
 * `topic_count_text` array
 * Nooped plural text from [_n_noop()](https://developer.wordpress.org/reference/functions/_n_noop/)
   to supply to tag counts. Default null.
 * `topic_count_text_callback` callable
 * Callback used to generate nooped plural text for tag counts based on the count.
   Default null.
 * `topic_count_scale_callback` callable
 * Callback used to determine the tag count scaling value. Default [default_topic_count_scale()](https://developer.wordpress.org/reference/functions/default_topic_count_scale/).
 * `show_count` bool|int
 * Whether to display the tag counts. Default 0. Accepts 0, 1, or their bool equivalents.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/wp_tag_cloud/?output_format=md#source)󠁿

    ```php
    $return = apply_filters( 'wp_tag_cloud', $return, $args );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/category-template.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/category-template.php#L778)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/category-template.php#L778-L778)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/wp_tag_cloud/?output_format=md#related)󠁿

| Used by | Description | 
| [wp_tag_cloud()](https://developer.wordpress.org/reference/functions/wp_tag_cloud/)`wp-includes/category-template.php` |

Displays a tag cloud.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/wp_tag_cloud/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.3.0](https://developer.wordpress.org/reference/since/2.3.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/hooks/wp_tag_cloud/?output_format=md#user-contributed-notes)󠁿

 1.   [Skip to note 3 content](https://developer.wordpress.org/reference/hooks/wp_tag_cloud/?output_format=md#comment-content-4000)
 2.    [tarhe](https://profiles.wordpress.org/obt28/)  [  6 years ago  ](https://developer.wordpress.org/reference/hooks/wp_tag_cloud/#comment-4000)
 3.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_tag_cloud%2F%23comment-4000)
     Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_tag_cloud%2F%23comment-4000)
 4.  **Basic Example **
      Adds `rel="nofollow"` to all the tag cloud links.
 5.      ```php
         add_filter( 'wp_tag_cloud', 'wpdocs_no_follow_tag_cloud_links' );
         function wpdocs_no_follow_tag_cloud_links( $return ) {
         	$return = str_replace('<a ', '<a rel="nofollow" ', $return );
         	return $return;
         }
         ```
     
 6.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_tag_cloud%2F%3Freplytocom%3D4000%23feedback-editor-4000)
 7.   [Skip to note 4 content](https://developer.wordpress.org/reference/hooks/wp_tag_cloud/?output_format=md#comment-content-5966)
 8.    [buddhabackpacker](https://profiles.wordpress.org/buddhabackpacker/)  [  4 years ago  ](https://developer.wordpress.org/reference/hooks/wp_tag_cloud/#comment-5966)
 9.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_tag_cloud%2F%23comment-5966)
     Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_tag_cloud%2F%23comment-5966)
 10. This “filter” only returns the HTML after generated. There is no longer a filter
     for the args before generating.
 11.  * That’s precisely what’s implied in the description of the filter: “Filters 
        the tag cloud **output**“. It filters the HTML output, not the arguments.
      * [Jb Audras](https://profiles.wordpress.org/audrasjb/) [4 years ago](https://developer.wordpress.org/reference/hooks/wp_tag_cloud/#comment-5970)
 12.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_tag_cloud%2F%3Freplytocom%3D5966%23feedback-editor-5966)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_tag_cloud%2F)
before being able to contribute a note or feedback.