
I guess you know what we are going to talk about ? Yes you are right we are going to know how to add rel=”noflollow” in WordPress automatically.We use rel=”nofollow” to tell spider not to follow the link.When spider like googlebot crawl our site they follow the link they find in our site and go to that page.And that page linked from our site get benefit from that link.Usually WordPress doesn’t add rel=”nofollow” to the external links automatically.You have to add it manually.Like below you have to edit the source code of your post.
<a title="wordpress the blogging tool" href="http://wordpress.org/" target="_blank" rel="nofollow">WordPress</a>
Here we added rel=”nofollow” within tag which is used for creating link in HTMl.Every time you put an external link in your post, you have to edit the source code and put the rel=”nofollow” code.It’s annoying isn’t it ? Now here comes the trick you can put a little code snippet in you theme function.php file to get rid of this problem.So go to your theme folder and open function.php file and put these line from bellow.You can put these line at the bottom as well as at the top.But never forget that you have to put this after
add_filter('the_content', 'auto_nofollow');
function auto_nofollow($content) {
return stripslashes(wp_rel_nofollow($content));
return preg_replace_callback('/<a>]+/', 'auto_nofollow_callback', $content);
}
function auto_nofollow_callback($matches) {
$link = $matches[0];
$site_link = get_bloginfo('url');
if (strpos($link, 'rel') === false) {
$link = preg_replace("%(href=S(?!$site_link))%i", 'rel="nofollow" $1', $link);
} elseif (preg_match("%href=S(?!$site_link)%i", $link)) {
$link = preg_replace('/rel=S(?!nofollow)S*/i', 'rel="nofollow"', $link);
}
return $link;
}
And save this file.That’s hit from now all of your external link will be modified automatically and rel=”nofollow” will be added automatically to all external link.
Thanks goes to OnextraPixel for this hack.
Please let me know if you’re looking for a author for your site. You have some really good articles and I think I would be a good asset. If you ever want to take some of the load off, I’d absolutely love to write some content for your blog in exchange for a link back to mine.
Please blast me an email if interested. Cheers!
Excellent pieces. Keep writing such kind of
information on your blog. Im really impressed by your
site.
Hi there, You’ve performed an excellent job. I will definitely digg it and in my view recommend to my friends. I’m sure
they’ll be benefited from this site.
For newest information you have to go to see web
and on world-wide-web I found this web page as a finest website for newest updates.
Thnx for writing this resource on your website.
Very shortly this web page will be famous among all blog viewers,
due to it’s good articles or reviews
I wish so.Thanks for your review
It’s going to be ending of mine day, however before ending I am reading this wonderful piece of writing to increase my know-how.
It’s not my first time to pay a quick visit this website, i am visiting this web page dailly and get good facts from here all the time.
Thanks for your personal marvelous posting! I genuinely enjoyed reading it, you will be a great author.
I will always bookmark your blog and definitely
will come back in the future. I want to encourage continue your
great writing, have a nice day!