wp_generate_tag_cloud

Filters the generated output of a tag cloud.

Description

apply_filters( 'wp_generate_tag_cloud', (array|string) $return, (array) $tags, (array) $args ); 

The filter is only evaluated if a true value is passed to the $filter argument in wp_generate_tag_cloud().

Parameters (3)

0. $return (array|string)
String containing the generated HTML tag cloud output or an array of tag links if the format argument equals array..
1. $tags (array)
An array of terms used in the tag cloud.
2. $args (array)
An array of wp_generate_tag_cloud() arguments.

Usage

To run the hook, copy the example below.
  1. $return = apply_filters( 'wp_generate_tag_cloud', $return, $tags, $args ); 
  2.  
  3. if ( !empty( $return ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the wp_generate_tag_cloud callback 
  2. function filter_wp_generate_tag_cloud( $return, $tags, $args ) { 
  3. // make filter magic happen here... 
  4. return $return
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'wp_generate_tag_cloud', 'filter_wp_generate_tag_cloud', 10, 3 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'wp_generate_tag_cloud', 'filter_wp_generate_tag_cloud', 10, 3 ); 

Defined (1)

The filter is defined in the following location(s).

/wp-includes/category-template.php  
  1. return apply_filters( 'wp_generate_tag_cloud', $return, $tags, $args );