wp_tag_cloud
TAG TAGS
What It Does
Displays a list of tags in a “tag cloud”. A tag cloud displays a list of tags where the tags vary in size depending on the number of times it has been assigned to a post. The more times a tag is used, the larger it displays and the less a tag is used, the smaller it displays.
Code
There are a number of parameters you can specify with wp_tag_cloud. These are:
Smallest
The smallest size of a tag that will be shown.
Largest
The largest size of a tag that will be shown.
Unit
The unit of measure when specifying “smallest” and “largest”. For example, px, pt, %, em. By default, pt is used.
Number
The number of tags to be shown in the tag cloud. By using the number 0, all tags will be displayed.
Format
There are three formats that can be used when displaying the tag cloud. These are:
- Flat – The tags are seperated by blank whitespace (default usage)
- List – The tags are shown in a list with the CSS class “wp-tag-cloud”
- Array – The tags are gathered in an array for use in PHP and are not shown
Orderby
Allows you to choose how the tags are ordered.
- Name – Order the tags by name (default usage)
- Count – Order the tags by count
Order
Allows you to specify in which order the tags will be sorted.
- ASC – Ascending order (default usage)
- DESC – Descending order
- RAND – random order
Exclude
Allows you to choose which tags to exclude from the tag cloud, specified by their numerical ID.
Include
Allows you to choose only which tags to include in the tag cloud, specified by their numberical ID.
Taxonomy
Taxonomy to use when generating the tag cloud. This parameter is only available in WordPress versions 2.8 and above.
- post_tag – Post tags are used in the tag cloud (default usage)
- category – Post categories are used in the tag cloud
- link_category – Link categories are used in the tag cloud
Example
The above example would display a tag cloud with the smallest font size of 8px, the largest font size of 18px, excluding tag number 7 with the tags ordered by count.




