Updating the tag cloud text size in WordPress

If you use a WordPress blog system for your website, something which of course is very useful, is the list of ‘tags’ (keywords) you can assign to each of your blog posts.

However, in the current versions of WordPress, whenever you do a WordPress update, it returns the tag cloud to the default settings (ie the size varies considerably, depending on the number of times the tag is used throughout your website):


Then around line 613, you should see something like the following:

$defaults = array(
  'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45,
  'format' => 'flat', 'separator' => "n", 'orderby' => 'name', 'order' => 'ASC',
  'exclude' => '', 'include' => '', 'link' => 'view', 'taxonomy' => 'post_tag', 'echo' => true

Simply change the font size of ‘smallest’ and ‘largest’ to your preferred point sizes (the default is normally around 12pt)

I personally prefer to change the smallest to ‘1’, the largest to ‘1’, the unit to ’em’, and then change the ‘separator’ from “\n” to “,\n” (thus adding a comma immediate after each tag, and prior to a space before the next tag).

$defaults = array(
 'smallest' => 1, 'largest' => 1, 'unit' => 'em', 'number' => 45,
 'format' => 'flat', 'separator' => ",\n", 'orderby' => 'name', 'order' => 'ASC',
 'exclude' => '', 'include' => '', 'link' => 'view', 'taxonomy' => 'post_tag', 'post_type' => '', 'echo' => true