Generates a tag cloud (heatmap) from provided data.

The text size is set by the ‘smallest’ and ‘largest’ arguments, which will use the ‘unit’ argument value for the CSS text size unit. The ‘format’ argument can be ‘flat’ (default), ‘list’, or ‘array’. The flat value for the ‘format’ argument will separate tags with spaces. The list value for the ‘format’ argument will format the tags in a UL HTML list. The array value for the ‘format’ argument will return in PHP array type format.

The ‘tag_cloud_sort’ filter allows you to override the sorting. Passed to the filter: $tags array and $args array, has to return the $tags array after sorting it.

The ‘orderby’ argument will accept ‘name’ or ‘count’ and defaults to ‘name’. The ‘order’ is the direction to sort, defaults to ‘ASC’ and can be ‘DESC’ or ‘RAND’.

The ‘number’ argument is how many tags to return. By default, the limit will be to return the entire tag cloud list.

The ‘topic_count_text’ argument is a nooped plural from _n_noop() to generate the text for the tooltip of the tag link.

The ‘topic_count_text_callback’ argument is a function, which given the count of the posts with that tag returns a text for the tooltip of the tag link.

Signature

wp_generate_tag_cloud( $tags, $args = '' )
tags
 (array) List of tags.
args
 (string|array) Optional, override default arguments.
Default: ''

Return

(string|array) Tag cloud as a string or an array, depending on 'format' argument.

Source

function wp_generate_tag_cloud( $tags, $args = '' ) {
	$defaults = array(
		'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 0,
		'format' => 'flat', 'separator' => "\n", 'orderby' => 'name', 'order' => 'ASC',
		'topic_count_text' => null, 'topic_count_text_callback' => null,
		'topic_count_scale_callback' => 'default_topic_count_scale', 'filter' => 1,
	);

	$args = wp_parse_args( $args, $defaults );

	$return = ( 'array' === $args['format'] ) ? array() : '';

	if ( empty( $tags ) ) {
		return $return;
	}

	// Juggle topic count tooltips:
	if ( isset( $args['topic_count_text'] ) ) {
		// First look for nooped plural support via topic_count_text.
		$translate_nooped_plural = $args['topic_count_text'];
124 more lines...
WP Trac GitHub

Link here