diTii.com Digital News Hub

Sign up with your email address to be the first to know about latest news and more.

I agree to have my personal information transfered to MailChimp (more information)


Nofollow Reciprocity Plugin

This plugin detects links to above mentioned sites, and puts ‘nofollow’ tags on them. ‘Do unto others as you would have others do unto you.’ WordPress is a major blogging platform, with tens of millions of users. If many people using WordPress use this plugin, other big sites may reconsider their ‘nofollow’ strategy. This plugin expands on Wikipedia nofollow plugin hacked by a revolted blogger. I also recommend few related ‘nofollow’ plugins on this blog’s SEO page.

Plugins Page | Download

Or Copy (CTRL+C) code below and save it into file named ‘nofollow-reciprocity.php’

class="extlink" (and optionally, target="_blank").
Author: Mark Jaquith
Version: 1.3
Author URI: http://txfx.net/

/*Copyright 2005Mark Jaquith (email: [email protected])
Additional changes Copyright 2007 Ken Yasumoto-Nicolson (email: [email protected])

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

function wp_get_domain_name_from_uri($uri){
preg_match("/^(http:\/\/)?([^\/]+)/i", $uri, $matches);
$host = $matches[2];
preg_match("/[^\.\/]+\.[^\.\/]+$/", $host, $matches);
return $matches[0];

function wp_has_no_rel_nofollow($text)
if ( preg_match("/rel=[\"\'].*?nofollow.*?[\"\']/i", $text ) )
return false;
return true;

function wp_inarray($needle, $array, $searchKey = false)
if ($searchKey) {
foreach ($array as $key => $value)
if (stristr($key, $needle)) {return $key;}
else {
foreach ($array as $value)
if (stristr($value, $needle)) {return $value;}
return '';

function parse_nofollow_reciprocity($matches)

//add in next line's array sites that you think do not deserve credit because they don't give it to other sites.
if ( wp_inarray(wp_get_domain_name_from_uri($matches[3]), array("wikipedia.org","del.icio.us","stumbleupon.com","ma.gnolia.com","simply.com","blinklist.com","startaid.com","netvouz.com","facebook.com","shadows.com","yahoo.com","google.com","thisnext.com-removed-due-to-users-feedback","linkter.hu","segnalo.alice.it","addthis.com","youtube.com","blogger.com")) &&
wp_has_no_rel_nofollow( $matches[1] ) &&
wp_has_no_rel_nofollow( $matches[4] ) )
return '' . $matches[5] . '';
// Do nothing
return '' . $matches[5] . '';

function wp_nofollow_reciprocity($text)
$pattern = '/(.*?)<\/a>/i';
$text = preg_replace_callback($pattern,'parse_nofollow_reciprocity',$text);
return $text;

// filters have high priority to make sure that any markup plugins like Textile or Markdown have already created the HTML links
add_filter('the_content', 'wp_nofollow_reciprocity', 999);
add_filter('the_excerpt', 'wp_nofollow_reciprocity', 999);

// delete this one if you don't want it run on comments
add_filter('comment_text', 'wp_nofollow_reciprocity', 999);

Nofollow Reciprocity, Plugins, WordPress Plugins

Share This Story, Choose Your Platform!