Genesis Themes

  • Home
  • Genesis Tutorials
  • WP Tutorial
  • Twenty Fifteen Theme
  • Social Media
  • WP Plugins

How to No follow External Links in WordPress

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.

rel=no follow

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.

Related Posts

  • Best Settings for Async JS and CSS WordPress Plugin
  • Specify a Vary: Accept-Encoding header in WordPress
  • How to Inline Small JavaScript Files
  • How to Enable Gzip Compression in WordPress
  • Show one category Posts on Home Page in WordPress 2015 theme
  • How to Create a Mobile Friendly Responsive Menu in WordPress
  • How to Remove Website Field from WordPress Comments
  • Speed Up Your WordPress Cache Without Plugins
  • Remove WordPress Emoji Script and Style
  • Error Establishing a Database Connection in WordPress

Bluehost and Siteground Coupons for January 2016.

Best Premium WordPress Themes from TemplateMonster
download wordpress themes from MonsterOne

Categories

  • Blog
  • Blogger
  • Genesis Tutorials
  • Social Media
  • Top Websites
  • Twenty Fifteen WordPress Theme
  • WordPress Plugins
  • WordPress Tutorial