Nicola Mustone

Happiness Lead @ Automattic



Remove the “nofollow” From the Recent Comments

I noticed while testing my own blog that the Recent Comments widget in the footer of this site has a nofollow attribute for all the authors’ links. It makes sense to have this, but at the same time I didn’t want the nofollow on my own comments.

Here is how I removed it.

Why Is The nofollow There?

One of the easiest method to build your SEO with backlinks back in the days was to use comments on blogs, and this increased the number of spam comments.

The purpose of this attribute was to make SEO manipulation via blog comments less effective, so introducing that in WordPress comments was supposed to demotivate spammers to use comments to get backlinks. Although it reduced the number of spam comments, some spammers still thought and think today that a nofollow link is better than no link at all.

Should You Remove The nofollow?

You might think that removing the nofollow attribute might encourage readers to genuinely comment on your site. Even if this might be true, you would still not gain any benefits from having spam comments that might bypass some security systems, like Akismet for example, or allowing the crawler to go to the site of a random reader that you’ve never seen before. For this reason, I still think that you should not remove it.

But why did I remove it then? Well, I didn’t, not entirely at least. I removed it only from commenters that I personally trust and know.

I wrote a little snippet that removes the nofollow attribute only on comments that I write personally. I will probably expand the list of trusted commenters with time. To begin with, I think that trusting myself is a good first step.

How Do I Remove The nofollow on My Own Comments?

Before you make any code changes, have a backup of your site. This will help you restore things in case of unforeseen errors. I recommend using Jetpack Backup for real-time backups and one-click restores.

Add this script at the end of your functions.php file in wp-content/themes/your-child-theme-name/:

Make sure to replace Your Name with the name shown on your WordPress profile.


Subscribe to This Blog

Receive new articles from this blog directly in your inbox! No spam guaranteed!

Join 670 other subscribers

3 responses to “Remove the “nofollow” From the Recent Comments”

    1. I’m glad you like the article, Maria!

  1. I’m adding your snippet and it just doesn’t work. Any ideas of what could be wrong? Does it work on your side? What exactly do you use for the $author variable?

Leave a Reply

You Might Also Like These Articles


Contribute to Improving This Blog

Did you enjoy this article? Was it helpful? Contribute to help me write more articles! The funds collected from this blog are reinvested directly into improving my skills or the blog so that I can provide more and better content!

One-Time
Monthly
Yearly

Make a one-time donation

Make a monthly donation

Make a yearly donation

Choose an amount

€1.00
€5.00
€10.00
€5.00
€15.00
€100.00
€5.00
€15.00
€100.00

Or enter a custom amount


Your contribution is appreciated.

Your contribution is appreciated.

Your contribution is appreciated.

DonateDonate monthlyDonate yearly

Don't Miss a Thing!

Receive new articles from this blog directly in your inbox!

No spam guaranteed!

Join 670 other subscribers

Continue Reading

Discover more from Nicola Mustone

Subscribe now to keep reading and get access to the full archive.

Continue reading