Alter The WordPress Tag Cloud Widget Output

WordPress provides a handy little widget where you can add your sites tags to a widgetised area and then are shown a tag cloud type format. However the output of this tag cloud cannot be controlled, like it can with the wp_tag_cloud() function. Having wanted to change the output I set about trying to achieve this. In this post I will outlined how to alter the output of the tag cloud widget in WordPress.


The key to altering such things as this is to follow the WordPress golden rule which is never to edit the core files. Therefore to overcome this problem we need to look at the core files themselves for code which will allow us to manipulate the output of the widget without actually altering the core code.

Looking in the wp-includes folder of WordPress core we see a file named default-widgets.php. It is in this file where the Tag Cloud widget code is sourced. Looking at the code we can see that WordPress applies a filter to the arguments it supplies to the wp_tag_cloud() function. This filter is named widget_tag_cloud_args.

Therefore we can use this to manipulate the output of the tag cloud before it is outputted to the browser. The example below allows us (for example) to set the max and min font size for tags outputted.

[wpmark_gist id=”06c3402bd55e6288b9ea”]

This is a good example of WordPress’ extensibility, something which I will be speaking about at WordCamp Manchester at the end of June.

Speaking at WordCamp Manchester

At the end of June WordCamp Manchester takes place at Manchester Metropolitan University’s New Business School Building. I am pleased to able to say that I will be speaking at the unconference with a talk titled “Easy Extensible Plugins”.

Back in 2010 the first WordCamp in Manchester took place at the Metropolitan University as part of the WordCamp UK events and 2014 brings us back there for another informal gathering of WordPress developers, designers and users.

This will be the second time that I have spoken at a WordCamp event, the first being in April at WordCamp Sheffield. My t all will cover what an extensible plugin is, why we should be making our plugins extensible and the tools and functions we can use to do this.

I am really looking forward to the event and look forward to seeing everyone there.