Another Ways Remove all nofollow attributes from comments


Sponsored Links




I has written some tutorial How To Remove nofollow on Comments Text. Today tricks I will give another ways to do it, with more complex code and of course better code than before.

Remove all nofollow attributes from comments - Candice Swanepoel

Remove all nofollow attributes from comments - Candice Swanepoel

The ways to do this is simple as before, only write this code on your functions.php theme files and your are done. So let’s get started it.

// remove nofollow from comments
function do_dofollow($str) {
	$str = preg_replace(
		'~<a ([^>]*)s*(["|']{1}w*)s*nofollow([^>]*)>~U',
		'<a ${1}${2}${3}>', $str);
	return str_replace(array(' rel=""', " rel=''"), '', $str);
}
remove_filter('pre_comment_content',     'wp_rel_nofollow');
add_filter   ('get_comment_author_link', 'do_dofollow');
add_filter   ('post_comments_link',      'do_dofollow');
add_filter   ('comment_reply_link',      'do_dofollow');
add_filter   ('comment_text',            'do_dofollow');

And done, this code will do automatically the rest. Go to sleep and your WordPress site supported do follow comment because That code will remove all instances of the nefarious “nofollow” attribute from all comment items, including the author link and comment text. This is a great way to automatically remove nofollow with no plugins or hacking required.

Thanks for Thomas Scholz and Digging Into WordPress Authors to share this code

Photos courtesy egotstic

Subscribe to Full RSS Feed

RSS FeedIf you thing this article useful, please consider subscribing to our RSS Feed or e-mail updates and stay updated with us. You can also follow @WPTricksNet on twitter for latest updates.

About WP Tricks

We are WordPress Family, we collected and writed useful tips and tricks for you WordPress. We share it for you...

Related Tips and Trick from Local Data and on The Net

Tutorial Enable HTML markup in user profiles / WordPress Tricks & Tips

Daily The Best WordPress Tricks and WordPress Tips to Another Ways Remove all nofollow attributes from comments Read More

nofollow - Wikipedia, the free encyclopedia

that automatically remove the nofollow from one website to another. However, some SEOs have suggested that a nofollow Use of nofollow where comments or other user Read More

Tips 4 Blogspot: Removing NoFollow from Blogger styled layouts

Another thing - there have been comments that the hack only remove NOFOLLOW from the author fairly new to all this fun bloggy stuff so I'm looking for ways to Read More

How to remove nofollow attribute from your WordPress blog » The

and making work another need to edit and all you have to do is remove the word nofollow. makes sense to remove the NoFollow attribute from your blog to get more comments. Read More

How To Get More Comments On Your Blog By Removing ‘No Follow’

There are at least 3 ways to remove disables the rel=”nofollow” attributes not to remove rel=”nofollow” from some types of comments. Removing no follow is another Read More


5 Responses to Another Ways Remove all nofollow attributes from comments

  1. Pingback: Tweets that mention Tutorial Remove all nofollow attributes from comments # WordPress Tricks & Tips -- Topsy.com

  2. Pingback: WordPress for Android | Unlock IMEI Cellphones

  3. Iurie says:

    Sorry, if I am wrong, but I think you have a mistake on row 4. I think it should look like this: ’~]*)s*(["|"]{1}w*)s*nofollow([^>]*)>~U’,.
    And a question about row 6: Is a difference between ’ rel=”"‘ and ” rel=””?

    Regards, Iurie

  4. Iurie says:

    Sorry, if I am wrong, but I think you have a mistake on row 4. I think it should look like this:
    ’~]*)s*(["|"]{1}w*)s*nofollow([^>]*)>~U’,.

    And a question about row 6: Is any difference between
    ’ rel=”"‘ and ” rel=””?

    Regards, Iurie

  5. Iurie says:

    Sorry for repeated comments.
    I apologize for repeating the comments. I wanted to make them look better but I failed. A preview would have been welcome.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>