• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2785

Original Genesis & WooCommerce Tutorials & 6000+ Guaranteed Code

Snippets

  • Try Premium
  • Log in

Remove No Follow From Comment Author Link & Comment Content Text Area Links

The code snippets in this tutorial remove the default rel="nofollow" from links added in the comment content area as well as the comment author link.

You can use the code to remove the rel="nofollow" completely or change it to rel="external"

Remove No Follow From Comment Author Links

Remove No Follow From Comment Content Text Area Links

Remove rel="nofollow" from comment content text :

Uses str_ireplace

Enable Removal of No Follow From Comment Content Links

This code doesn’t remove the rel="nofollow" attribute from HTML links in comments however its does enable you to remove them manually so you can choose which links are no follow and which are do follow.

Note : The above code only works when adding HTML links with a tags like this

<a href="example.com">Link</a>

but doesn’t remove nofollow when adding text links like this

http://example.com
Remove No Follow From Raw Text Links

The following code removes the rel="nofollow" attribute from raw text links which are added to comments.

So links added to comments like this :

http://example.com

Which WordPress would turn into this :

<a href="http://example.com" rel="nofollow">http://example.com</a>

Now become this :

<p>http://example.com</p>

Comments

Reader Interactions

Comments

  1. Gaurav Tiwari says

    May 15, 2018 at 10:05 am

    Is the first code only for genesis?

    Log in to Reply
    • Brad Dalton says

      May 15, 2018 at 11:01 am

      Uses a genesis hook so only works in Genesis

      Log in to Reply
  2. ansar pasha says

    August 4, 2017 at 10:45 pm

    I think there is a slight error in wording above – the second code removes links altogether, not just the “nofollow” attribute from links. As a result, there are no links in comments left.

    Log in to Reply
    • Brad Dalton says

      August 5, 2017 at 4:44 am

      Ansar. Try using ONLY the 3rd and 4th snippets. Based on my testing, this removes nofollow from text links enabling you to manually add it back using HTML and also enables you to remove nofollow from HTML links manually.

      The problem is, if you use code to remove nofollow from HTML links, then you can’t add it back manually because the code will remove it on page load.

      Log in to Reply

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Code written by Brad Dalton specialist for Genesis, WooCommerce & WordPress theme customization. Read More…

Advertise · WPEngine · Genesis · Log in

  • Access Problems
  • Account Details
  • Consulting
  • Tags