Nofollow tag cloud for WordPress

I love the tag cloud widget that comes with WordPress. There’s just one thing that bugs me: it floods every post or page with lots of internal links that a search engine crawler will follow. The SEO community says that this could be seen as some sort of artificial link generation by a search engine and eventually lead to a disadvantage in a site’s SERP ranking. Having fewer internal links on a post should also pass a higher page rank to linked posts as well. See this post from Matt Cutts detailing how it makes sense to nofollow non-essential internal links:

There’s no stigma to using nofollow, even on your own internal links; for Google, nofollow’ed links are dropped out of our link graph; we don’t even use such links for discovery. By the way, the nofollow meta tag does that same thing, but at a page level.

Unfortunately, it’s not possible to instruct the built-in WordPress tag cloud sidebar widget to use nofollow tags for the generated links.

I enhanced the tag-cloud widget with a configurable nofollow-enhancment and I’m trying to submit this to the WordPress repository. The default setting will not insert the nofollow tag. The option has to be checked in the tag cloud widget’s configuration area. You’ll find my WordPress Trac ticket here in case you want to vote for it and/or check the current state. It probably will take a couple of months until the changes are tested and make it into an official WordPress release (if at all).


Since my change request has been denied, a smart head provided a pretty sleek solution to add the nofollow tag in the tag cloud widget by using an API filter. Just add this code at the end of your wp-config.php file and you’re all set.

add_filter( 'wp_generate_tag_cloud', 'my_nofollow_tag_cloud_example' );
function my_nofollow_tag_cloud_example( $text ) {
   return preg_replace_callback('|<a (.+?)>|i', 'wp_rel_nofollow_callback', $text);

9 replies on “Nofollow tag cloud for WordPress”

  1. Your code is great. I’ve copied it in functions.php, instead of wp-config.php.

  2. I got some doubts regarding the twitter feed in the website. does that cause any problem crawling more links through twitter..

  3. thanks a lot for the share. i was shocked to see 40 results in google for my 4 pages site just because of the tag cloud. Helped me a lot..

  4. Pingback: Adding the nofollow attribute in Wordpress Tag Cloud and tag links - INBOX International
  5. It didn’t hurt the ranking of this site in any way when I removed the nofollow tag, so there’s no point for me to use it.


  6. Thank you for that information and code. I see your Tagcloud is not nofollow, how comes?


  7. Pingback: Adding the nofollow attribute in Wordpress Tag Cloud and tag links |
  8. Unfortunately, my change request has been denied by the WordPress repository managers stating that it is too complicated for the average user to know what a nofollow setting does. I have to agree with that.

Comments are closed.