How to Nofollow All External Links in WordPress

In today’s post, I will tell you how to nofollow all external links in your WordPress site. Simply put, there are two kinds of methods. Use plugin or Add directly.

1.NoFollowr WordPress Plugin

NoFollowr is now available for download at the official WordPress plugin directory. You can find and install it via your WordPress admin’s plugins page for easy installation and automated upgrades.

DownLoad Links: http://nofollowr.com/

2.Add Code in Funtions.php File

add_filter('the_content', 'auto_nofollow');
function auto_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;
}
</a>