×

How to make Post links do follow in wordpress

default single post image

Do not confuse yourself ,  I am not going to suggest you any plugin to make a post link do follow?  I am sure you have searched a lot of website and find a lots of silly plugins to make comment author or their comments links do follow. Yes most of the time we try to make give back something to our valuable commentator.

Some times, we need to even reward our guest bloggers for their valuable work as they render their best to us. I think they also need a do-follow links. Most of the time, your wordpress templates and famous WordPress plugins, by default create all  external links no-follow and all the internal links do-follow.

A very simple tricks can make all your no-follow links into do follow link. follow the steps-

Open your post in your editor in HTML mode ( do not turn it into visual mode)

  • Locate the link , you want to make do follow
  • add rel=”do-follow”   like this < a rel=”do-follow”  “http://binaryNote.com” target=”_black” title=”reliable , accurate, secure technological blogging tips”> Binarynote.com </a>
  • Save your work

Now check your work. it looks very fine if you check these links using some sort of  extensions or plugins. BUT whenever you check the same using it’s source code you are little bit troubled .Becouse it display both nofollow and do-follow both. Confused !!!!!!!!How your link may behave like a no-follow and do-follow  at the same time.  Your customer and Guest Blogger will never ever accept this solution

So where it the solution? Solution lies in the core of WordPress, BUT, I would never suggest you to hack your wordpress core. Another perfect simple solution

Open your WordPress function.php file and type the following code in this file

function strip_nofollow($text = '') {
return preg_replace_callback("/<s*as+(.+?)>/is", 'strip_nofollow_callback', $text); }
function strip_nofollow_callback($match) {
$attr = $match[1];
$attr = " $attr ";
$attr = preg_replace("/
s
rels*=s*(['"])
([^1]*?s+)?
nofollow
(s+[^1]*?)?
1
/ix", " rel=$1$2$3$1", $attr);
$attr = preg_replace("/
s
rels*=s*(['"])s*1
/ix", '', $attr);
$attr = trim($attr);
return '<a ' . $attr . '>';
} add_filter('the_content', 'strip_nofollow', 15);

The above function does not make any changes in the core or in the WordPress database, it simply changes all the occurrence of no-follow tags into do-follow tags.

How do you like this do-follow hack to make post links do-follow, Be sure to share your experience with us.

Related Posts

23 thoughts on “How to make Post links do follow in wordpress”

  1. it does not work on my blog, error message is “Parse error: syntax error, unexpected ‘]’ in /home/ooraopal/public_html/acaiberrydietx.com/wp-content/themes/codium-extend/functions.php on line 10”

    1. Commentluv wordpres plugin can enable comment’s link ad do-follow. But most webmaster refrain them self from it.

  2. nofollow and dofollow are the same i think and for sure that they are good , Thanks you any way

  3. This information is extremely helpful, knowing how to change a post from nofollow into dofollow can help get so much more pagerank and seo juice. Bookmarked and I even gave this post a nice backlink from one of my other sites for the great information, thanks =)

  4. hi. i agree with your opinion. this post was very well written, and it also contains many useful facts because the author have made it very easy for us to understand. right?

  5. Hi
    There is something that I see on many blogs,but don`t how it is done.I`m really hoping you can help me:

    “You can follow …… on Twitter, join our Facebook fanpage and add me on Google+ to keep yourself updated on the latest news”

    This is a post ender on a large number of sites.I`m trying to create one but dont know ho.Also if there is a way to do it with a plugin,that would be much better for am not any really good with codes
    Thaks

  6. You can instead download and activate a simple plugin in order to get this thing done . Every WP theme is different and this code cannot be applied to all of them

    1. Agreed, but a lots of people love to tweek thier website for optimum speed. This code snippet is only for those. Thank for your feedback dear.

  7. thanks for this rajesh, will this code do the trick in functions.php?

    function remove_nofollow($string) {
    $string = str_ireplace(‘ rel=”nofollow”‘, ”, $string);
    return $string;
    }
    add_filter(‘the_content’, ‘remove_nofollow’);
    add_filter(‘comment_text’, ‘remove_nofollow’);

Comments are closed.