No follow All External Links in WordPress
External links (Outbound ) with rel="do follow" will hurt search engines (especially Google). For better SEO purpose and great page rank, you must apply rel="no follow" for all external links in your website.
What is the difference between do follow and no follow links ?
By default, WordPress adds a rel="dofollow" attribute to all external links within the post,which is not at all a good sign for SEO. Here you must change this external links from do follow to no follow.
Example of do follow link : <a href="http://domain.com" rel="dofollow">Link keyword</a>
Example of no follow link :<a href="http://domain.com" rel="nofollow">Link keyword</a>
To change this as rel="nofollow" to all external links in WordPress post content, paste the following code in your theme's functions.php file.
Go to Appearances > Editor > Functions.php
Here's the code to add no follow external links WordPress post content.
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);
}</a>
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;
}
No follow external links WordPress plugin:
There are 2 WordPress plugins available to do same work,install any one of plugin to automatically no follow all external links in WordPress post content.
1.Wp External links and
2.External Links.
Need Help :
We hope that, you got clear idea on do follow and no follow external links.This WordPress tutorial helps you to automatically no follow all external links in WordPress post content.If you face any problem, let us know.