Usually I’d just call the wp_tag_cloud() function manually from a WordPress theme file, but I have a client who wants to use the Tag Cloud Widget on their site. The tag cloud widget has been in WordPress since WP 2.3. Unfortunately, it isn’t the easiest widget to use because you can’t customize it from the backend.

Luckily there are two filters that can be used to set the arguments your client needs and maintain the ability for them to modify the widget location from the WordPress backend.

  1. widget_tag_cloud_args – lets you set the wp_tag_cloud arguments
  2. wp_tag_cloud – lets you edit the wp_tag_cloud output

So, for my clients need’s, I just needed to set the small and large font size arguments and change the widget output a little to fit their sidebar properly. I added these lines to the theme’s function.php:

As with any function in WordPress, be sure to check out the codex for all the Tag Cloud Arguments that you can use.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.