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!

 

Hide Header and Footer In Elementor Within ONE minute

Elementor is awesome. That comes from a user has just begun to use the tool. However, when you start creating a page with Elementor, you may see the default header and footer from your theme. In my case, I use twenty seventeen theme and the editor would look like below. As I am going to create a dedicated page, I would like to hide header and footer in Elementor. What can I do about that?

default page template wordpress

Why does this happen?

Elementor uses the default template file from your theme. In the default template file of most themes, there are header and footer. That’s why you will see the header and footer of your theme in Elementor’s editor. If you deactivate Elementor, you would see the page template at the right sidebar:

Hide Header and Footer In Elementor Within ONE minute 2

Now, as you may guess, the solution would be using a different page template that doesn’t contain your theme’s header and footer. That’s what we are going to do.

How to hide header and footer in Elementor

Here are what we are going to do:

  • Install a plugin called Blank Slate
  • Go to your page/post created with Elementor
  • Edit its template to use Blank Slate

Let’s go into more details below.

As mentioned above, we need a template file that doesn’t have the theme’s header and footer. If you know a bit of PHP, you can do it easily. However, for people who don’t know code, that would be a difficult task. What we are going to do is simple for everyone. We are going to install a plugin that creates that template for us. The plugin is called Blank Slate.

After installing and activating the plugin, if you go back to edit your page and click on the page template select box, you will see there is a new template file called Blank Slate. That’s what we are going to use. All you need to do next is to click on publish (or save draft) and click on edit with Elementor:

Hide Header and Footer In Elementor Within ONE minute 3Hide header and footer in Elementor

 

Now, you can see that in Elementor, there isn’t header or footer:

Hide header and footer in Elementor

That’s it! You’ve successfully hidden the header and footer for your Elementor editor. It’s time to create some awesome pages with this page builder. If you enjoy my WordPress tips, don’t forget to share this post.