Add rel=”nofollow” to WordPress Categories

How to add nofollow relationship attribute to WordPress category links? Here’s how to do that, both with plugin and manually.

Add rel=”nofollow” to WordPress Categories

Webmasters curate their content differently. Some want their tags and categories crawled and followed by search engines, while some cease them from that. If we talk about links get followed by search engines, the first thing that comes to mind is nofollow link attributes.

Adding nofollow link attribute to category links is one of the common needs of webmasters with WordPress.
WordPress adds a default category and tag relationship attributes to category links, and we’ve already talked about how to remove rel=”category tag” from WordPress categories. This post covers how to add nofollow relationship attributes to WordPress category links, but before that, here’s a little preface on nofollow relationship attributes for hyperlinks.

What is rel=”nofollow”?

When we use rel=”nofollow” in a hyperlink, we’re telling search engines not to follow that link. And this way, search engines won’t follow that particular link and no PR juice will be passed to it.

<a href="...url.." rel="nofollow">Link with nofollow relationship attribute</a>

Add nofollow relationship attribute to WordPress category links

Back to the topic, the simplest way to get that is to install my nofollow Category plugin for WordPress. Or in case, you’re ready to fork up the code a bit, just open the functions.php file and paste the below code just before the closing php tag, i.e. ?gt; and save the changes:

add_filter( 'the_category', 'nofollow_category' );
function nofollow_category( $text ) {
$text = str_replace('rel="category tag"', 'rel="nofollow"', $text);
return $text;

Tada! Now, your WordPress category links have a nofollow relationship with search engines! Hope you found this useful.