How To Remove Nofollow Attribute On WordPress Comments Link (Author URL and Comment’s URLs) Update 2019 Without Using A Plugin

If you are searching for this, I assume that you don’t need any further introduction on nofollow and dofllow links. The nofollow attribute is added to links to prevent spam. However, there are times that you want to remove it to encourage comments from your visitors. In this post, I’m going to show you how to remove nofollow attribute from links at the comment section of WordPress.

How to remove the nofollow attribute from author’s name link

Here are the steps we are going to do to make the author’s name link become dofollow:

  1. Go to your theme’s function.php file
  2. Get to the bottom of that file
  3. Add the following code
add_filter('get_comment_author_link', 'binary_carpenter_remove_nofollow', 10, 1);

function binary_carpenter_remove_nofollow($content) {
   $content = preg_replace("/(<a[^>]*[^\s])(\s*nofollow\s*)/i", "$1", $content);
   $content = preg_replace("/(<a[^>]*[^\s])(\s*rel=[\"\']\s*[\"\'])/i", "$1", $content);
   return $content;
}

Now, if you save the file, you will see the nofollow attribute disappear in the link.

Let’s see the code in action:

As you can see that, after the code was inserted, the nofollow attribute was gone.

How to remove the nofollow attribute from links in the comments’ content

We can use the same strategy to remove the nofollow attribute from links that are located in the comments’ content. However, this time, you will need to add another filter. If you have added the function  binary_carpenter_remove_nofollow in the functions.php file, there is no need to declare it again.

Here is the code to remove the nofollow from comments’ content’s links:

add_filter('comment_text', 'binary_carpenter_remove_nofollow');

And that’s all you need to do to remove the nofollow attribute.

Conclusion

As you can see, the nofollow attribute is a useful tool to fight spam (spammers tend to not leaving a link on your site if it’s nofollow). However, if you have good reasons to make the links dofllow, you have the method to do so without using a plugin.

I hope the post has been helpful. Please like and share if you find it valuable. Thanks!

 

How Your Blog Reader Can Enable Comments Subscription In WordPress

Having visitors participate eagerly in the comment section is one of the most rewarding experience of any blog owners. However, the truth is many times visitors come and leave comment and never comeback. The reason mainly because they forget about the posts they left comments on. So, it would be great if there is a tool to remind them about the conversation they participated when there are new content added to the discussion. Fortunately, there is a plugin does exactly that for you.

How to get your reader subscribe to a post’s discussion using Subscribe to Comments Reloaded

We are going to install a plugin called Subscribe to Comments Reloaded, which you can download from here

After installing and activating the plugin, when you go to a single post on your site (make sure you are not logged in as admin), you will see there is a checkbox under the comment section:

If that’s all you need, you can stop here. Now, if your visitors check that checkbox and post their comment, they will net notified when there is new comment to the post.

However, if you want to fine tune reader’s experience, let’s go to the settings:

There are plenty of options which I’m not going to cover all of them here. However, here are the most important sections:

Comment Form:

Here you can set the text appear on the checkbox, whether to show the checkbox or not, whether to check the checkbox by default or not…

The plugin author did a great job on the management page so I think it’s best to leave it as it is. However, if you want to modify some wordings, feel free to customize the text here.

Now, there is another important tab, that is the Notification tab. This tab allows you to edit the notification email  you send to the subscribers:

Here, you can set the Sender name. By default, it’s your blog’s name. If you want to change this anything you want. However, leave it as your blog’s name will help the subscribers know exactly who is sending the email.

The sender email address is what will display on the sender field of the email. As you can see in the screenshot below from Gmail:

The reply to, if set is the email will receive the reply from your subscribe when they decide to reply to the notification. However, since it’s just a notification, there isn’t a need to get reply. Thus, you can leave this field blank.

In the email content, you can customize it with some placeholders as listed here:

[post_title], [comment_permalink], [comment_author], [comment_content], [post_permalink], [manager_link], [comment_gravatar]

All the placeholders have very clear names, thus, there is no explanation needed.

Conclusion

As you can see, this tool lets your visitors subscribe to the posts they leave comment on (then can also subscribe to the comments without commenting) which increase the likely that they will comeback to visit that post. It’s a win-win situation for you and your reader. The number of options you can customize is just huge. The plugin’s developer has done a great job with this one.