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>
Is the first code only for genesis?
Uses a genesis hook so only works in Genesis
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.
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.