WordPress.org

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Plugin API/Filter Reference/widget tag cloud args

Description

Filter the widget_tag_cloud_args.

apply_filters( 'widget_tag_cloud_args', 
array(
	'taxonomy' => $current_taxonomy,
	'echo' => false
) ) ); 

Parameters

 $args = array(
        'smallest' => 12, 
        'largest' => 18, 
        'unit' => 'pt', 
        'number' => 10,
        'format' => 'flat', 
        'separator' => "\n", 
        'orderby' => 'name', 
        'order' => 'ASC',
        'exclude' => '', 
        'include' => '', 
        'link' => 'view', 
        'taxonomy' => $current_taxonomy, 
        'post_type' => '', 
        'echo' => false
    );

By default, the usage shows:

  • smallest - The smallest tag (lowest count) is shown at size 8
  • largest - The largest tag (highest count) is shown at size 22
  • unit - Describes 'pt' (point) as the font-size unit for the smallest and largest values
  • number - Displays at most 45 tags
  • format - Displays the tags in flat (separated by whitespace) style
  • separator - Displays whitespace between tags
  • orderby - Order the tags by name
  • order - Sort the tags in ASCENDING fashion
  • exclude - Exclude no tags
  • include - Include all tags
  • link - view
  • taxonomy - Use post tags for basis of cloud
  • echo - echo the results

Examples

Include specific tag i.d's in tag cloud widget

add_filter( 'widget_tag_cloud_args', 'filter_tag_cloud_widget' );
function filter_tag_cloud_widget() {
    $include = array( 58, 59 );
    $args = array(
        'include' => $include,
        'taxonomy' => $current_taxonomy,
	'echo' => false,     
    );
    return $args;
}

Source File

widget_title is located in wp-includes/widgets/class-wp-widget-tag-cloud.php

Related

https://codex.wordpress.org/Function_Reference/wp_tag_cloud https://codex.wordpress.org/Plugin_API/Filter_Reference/wp_tag_cloud

External Resources