Hi, Like the title describe, I need a way to romove nofollow tag from a the content, not the comments.. I want when I'll add a link to the post content to be posted dofollow instead of the default nofollow. It exist any plugin that allow to add nofollow or dofollow link by link? How can I do that? Thanks in advance.
Just go to corner young man until you can learn how to listen. Here you go. Add the following to your functions.php file: / ** * Removes the value> nofollow <from the rel attribute. * * @ Author Thomas Scholz <http://toscho.de> * @ Contributor David Naber <http://blog.dnaber.de/> * @ Version 1.1 * @ License GPL 3 <http://www.gnu.org/licenses/gpl.html> * @ Param string $ str String to filtering * @ Return string * / function xwp_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', 'xwp_dofollow'); add_filter ('post_comments_link', 'xwp_dofollow'); add_filter ('comment_reply_link', 'xwp_dofollow'); add_filter ('comment_text', 'xwp_dofollow'); Code (markup): I left the coder's attribution in tact, but you can remove that portion if you wish.
Thank you for the code but this one turn all the blog to dofollow, I want only the links in the post content published by me dofollow.
I misread your post, sorry. If your links inside the post are nofollow, then you probably have your blog set in Privacy mode. Go to your Admin Dashboard and underneath Settings > Privacy make sure that the radio control is set to "I would like my site to be visible by everyone ..."
Yes it is checked and my blog is visible to all search engines, wordpress come with nofollow in post content and comments, there are some plugins that turn all the links in the blog including links on comments and in the comments URL but what I need is to be dofollow only in post content. I found when googling a code to add to function.php that will turn the urls in the post content dofollow but it's not compatible with the latest version of Wordpress!!
Reworking the other code for comments will work for post content as well: function xwp_dofollow_posts($content) { $content = preg_replace( '~<a ([^>]*)\s*(["|\']{1}\w*)\s*nofollow([^>]*)>~U', '<a ${1}${2}${3}>', $content); return str_replace(array(' rel=""', " rel=''"), '', $content); } add_filter ('the_content', 'xwp_dofollow_posts'); Code (markup):