Auto NoFollow External Links

Posted on 26th September, 2015 317 Comments

This snip will add a nofollow attribute to all external links.

function.php
/* 
 * 	NOFOLLOW EXTERNAL LINKS
 *************************************************************/
add_filter('the_content', 'my_nofollow');
add_filter('the_excerpt', 'my_nofollow');
function my_nofollow($content) {
    return preg_replace_callback('/<a[^>]+/', 'my_nofollow_callback', $content);
}
function my_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;
}

Comments

To preserve code added to a comment you can wrap your code in short tags
by using [square brackets]:

  1. PHP use - [php] <?php code here ?> [/php]
  2. CSS use - [css] #code-here {} [/css]
  3. HTML use - [html] <div> code here </div> [/html]
  4. JS use - [js] $(".codeHere") [/js]

JamesVen

21st, Oct, 20

for an neurogenic linseed filament is danged unobstructed or [url=https://ciamedusa.com/]cialis pills[/url] Lastly can be much geezer

JamesVen

21st, Oct, 20

would be required reassuring, care settings or chemicals on exertion. [url=https://ciamedusa.com/]tadalafil vs sildenafil[/url] Ukcofc eoytgi

Elmo Apland

01st, Nov, 20

I’d need to verify with you here. Which is not one thing I often do! I take pleasure in reading a submit that can make people think. Also, thanks for permitting me to remark!

my explanation 24 hr electrician

03rd, Dec, 20

Great beat ! I wish to apprentice whilst you amend your website, how could i subscribe for a weblog site? The account aided me a acceptable deal. I had been a little bit familiar of this your broadcast provided shiny transparent idea

Life Experience Degrees

07th, Dec, 20

Hi, There’s no doubt that your blog could be having web browser compatibility problems. Whenever I look at your blog in Safari, it looks fine however when opening in I.E., it’s got some overlapping issues. I simply wanted to provide you with a quick heads up! Apart from that, great blog.

Johnnie Conard

04th, Jan, 21

I’m looking for a nice digital camera under or around $200 for the purpose of blogging (as in wordpress, blogger, etc). I’m trying to get a blog which will be based around the daily photos I take despite the fact that I’m not really a photographer but only doing it for fun. Any cool features like video would also be great but mainly I’m just looking for something I can take quality pictures, and that will hopefully hide my total amateur abilities. . . Thanks guys!.

Ernestina Hibler

07th, Jan, 21

I take pleasure in, result in I discovered just what I was looking for. You’ve ended my four day long hunt! God Bless you man. Have a nice day. Bye

hey

07th, Jan, 21

Taxi moto line
128 Rue la Boétie
75008 Paris
+33 6 51 612 712  

Taxi moto paris

You really make it appear so easy along with your presentation however I in finding this matter to be really something which
I think I might by no means understand. It kind of feels too complex and
extremely huge for me. I am having a look forward
for your subsequent publish, I will attempt to get the
hang of it!

vreyrolinomit

10th, Jan, 21

Wow, superb blog layout! How long have you been blogging for? you make blogging look easy. The overall look of your site is great, as well as the content!

호텔카지노

15th, Jan, 21

Terrific paintings! That is the type of info that are meant to be shared around the internet. Disgrace on Google for no longer positioning this submit higher! Come on over and consult with my site . Thanks =)

더킹카지노

22nd, Jan, 21

Some genuinely nice and useful information on this web site, besides I think the style contains excellent features.

Google

23rd, Jan, 21

Google

That will be the finish of this article. Right here you will uncover some websites that we think you’ll value, just click the hyperlinks.

zortilo nrel

26th, Jan, 21

I keep listening to the newscast speak about getting boundless online grant applications so I have been looking around for the most excellent site to get one. Could you tell me please, where could i acquire some?

Google

30th, Jan, 21

Google

We prefer to honor a lot of other internet web pages around the web, even when they aren’t linked to us, by linking to them. Below are some webpages worth checking out.

cheap flights

01st, Feb, 21

What’s up, yes this article is actually fastidious and I have learned lot of
things from it concerning blogging. thanks.

cheap flights

01st, Feb, 21

We are a bunch of volunteers and starting a new scheme in our community.
Your web site provided us with valuable info to work
on. You’ve performed a formidable job and our
entire community might be grateful to you.

HEffenaind

02nd, Feb, 21

pharmacie lafayette valence, pharmacie carrefour pharmacie ouverte jour ferie pharmacie noyon amiens, pharmacie place wilson brest les therapies ciblees pharmacie nansouty bordeaux horaires pharmacie de garde knutange pharmacie ouverte jusqu’Г  21h pharmacie universite , pharmacie de garde beziers pharmacie auchan nice , https://u.to/aZr7Gg# pharmacie de garde aujourd’hui issy les moulineaux pharmacie drive avignon [url=https://u.to/-JH7Gg#]generic Metformin for sale online[/url] , pharmacie auchan saint sebastien pharmacie de garde marseille 11eme , [url=https://www.dior–outlet.com/prime-tips-for-selecting-the-best-vape-juice/comment-page-3/#comment-150429]positive reinforcement khan academy brest[/url] 32f6c38 medicaments bouffees de chaleur. pharmacie hemery brest pharmacie de garde aujourd’hui marignane [url=https://tinyurl.com/y383ho3a#]Order Prednisone online[/url] , pharmacie aix en provence geant casino pharmacie amiens saint maurice , pharmacie meaux.

gidrasajt4afgake

03rd, Feb, 21

gidrasajt4af.com являет собой портал, что открыт для дилеров подпольных вещей и сервисов. Аналогичную продукцию воспрещено взять в простом интернет-магазине, потому что это противозаконно.

Ecoannahus

05th, Feb, 21

microsoft office hindi software free download how much software engineer salary 2020 design software i leap office software free download, 2020 design software computer requirements download a drawing program for free . 2020 best free software free windows software 2020 hotel front office software free download bar software open source [url=https://u.to/QhH-Gg#]Acheter une licence 3DS Max 2017 pas chГЁre[/url] , free 2020 tax preparation software software programs for doctors office , [url=https://www.insurances.net/viewthread.php?tid=98828&pid=40735106&page=1&extra=#pid40735106]program like design space Ca cheap[/url] b7a96f0 pharmacie guillon argenteuil horaire. free flipbook software 2020 dental office xpress software [url=https://u.to/wxr-Gg#]Achat Sketchup Pro 2020 moins cher[/url] , how many microsoft office programs are there microsoft office suite for macbook pro , how software engineering is a social learning process. what drawing program does jaiden animations use who software for sample size calculation , software above the level of a single device drawing which program .

Shell İndir Php

09th, Feb, 21

This site definitely has all of the information and facts I wanted about this subject and didn’t know who
to ask.

loan consultant

10th, Feb, 21

loan consultant

[…]Wonderful story, reckoned we could combine a number of unrelated data, nevertheless seriously worth taking a look, whoa did a single find out about Mid East has got far more problerms also […]

185

10th, Feb, 21

185

[…]we came across a cool site that you could take pleasure in. Take a look should you want[…]

샌즈카지노

11th, Feb, 21

샌즈카지노

[…]we came across a cool website which you may get pleasure from. Take a look if you want[…]

JACK HERER DANK VAPES

11th, Feb, 21

JACK HERER DANK VAPES

[…]here are some links to web sites that we link to simply because we believe they may be worth visiting[…]

메리트카지노

11th, Feb, 21

메리트카지노

[…]we prefer to honor many other internet internet sites on the internet, even if they aren’t linked to us, by linking to them. Below are some webpages really worth checking out[…]

코인카지노

11th, Feb, 21

코인카지노

[…]just beneath, are several completely not connected sites to ours, even so, they’re surely worth going over[…]

퍼스트카지노

11th, Feb, 21

퍼스트카지노

[…]here are some links to web sites that we link to for the reason that we think they may be worth visiting[…]

Kingpen

12th, Feb, 21

Kingpen

[…]Here is a good Blog You may Come across Intriguing that we Encourage You[…]

click here

15th, Feb, 21

click here

[…]usually posts some extremely intriguing stuff like this. If you’re new to this site[…]

AnaGlobal

15th, Feb, 21

AnaGlobal

[…]the time to read or stop by the content material or sites we have linked to beneath the[…]

voyage en cargo

15th, Feb, 21

voyage en cargo

[…]Wonderful story, reckoned we could combine a couple of unrelated information, nevertheless definitely really worth taking a appear, whoa did 1 study about Mid East has got far more problerms too […]

best cbd oil

15th, Feb, 21

best cbd oil

[…]below you will uncover the link to some websites that we feel you should visit[…]

cbd oil

15th, Feb, 21

cbd oil

[…]the time to study or check out the content material or websites we have linked to beneath the[…]

best cbd for dogs

16th, Feb, 21

best cbd for dogs

[…]always a significant fan of linking to bloggers that I love but really don’t get quite a bit of link really like from[…]

best cbd oil for dogs

16th, Feb, 21

best cbd oil for dogs

[…]please take a look at the internet sites we follow, including this 1, because it represents our picks in the web[…]

best cbd gummies

16th, Feb, 21

best cbd gummies

[…]Wonderful story, reckoned we could combine a couple of unrelated information, nonetheless definitely worth taking a appear, whoa did 1 understand about Mid East has got far more problerms at the same time […]

sphynx cat for sale

16th, Feb, 21

sphynx cat for sale

[…]very couple of sites that happen to become comprehensive beneath, from our point of view are undoubtedly very well worth checking out[…]

red maeng da kratom

17th, Feb, 21

red maeng da kratom

[…]that could be the finish of this article. Here you’ll find some internet sites that we consider you’ll enjoy, just click the links over[…]

white maeng da kratom

18th, Feb, 21

white maeng da kratom

[…]Wonderful story, reckoned we could combine a couple of unrelated information, nevertheless really really worth taking a look, whoa did one study about Mid East has got extra problerms at the same time […]

buy instagram followers

21st, Feb, 21

buy instagram followers

[…]Wonderful story, reckoned we could combine some unrelated information, nevertheless really really worth taking a search, whoa did a single master about Mid East has got additional problerms as well […]

https://www.lekekremim.com/

21st, Feb, 21

Hey, I think your blog might be having browser compatibility issues.
When I look at your blog in Chrome, it looks fine but when opening in Internet Explorer, it has some overlapping.

I just wanted to give you a quick heads up!
Other then that, amazing blog!

mobile apps development

22nd, Feb, 21

mobile apps development

[…]Wonderful story, reckoned we could combine a handful of unrelated data, nonetheless seriously worth taking a search, whoa did one particular study about Mid East has got more problerms as well […]

Mzadaty Djibouti

23rd, Feb, 21

Mzadaty Djibouti

[…]the time to study or check out the content material or web-sites we have linked to beneath the[…]

masturbation tips

27th, Feb, 21

masturbation tips

[…]the time to study or check out the material or internet sites we’ve linked to below the[…]

Gay Porn

28th, Feb, 21

Gay Porn

[…]just beneath, are several absolutely not associated internet sites to ours, however, they may be certainly worth going over[…]

Can I buy Morphine online

28th, Feb, 21

Can I buy Morphine online

[…]we prefer to honor lots of other online sites around the internet, even when they aren’t linked to us, by linking to them. Underneath are some webpages really worth checking out[…]

kratom for sleep

01st, Mar, 21

kratom for sleep

[…]very couple of internet websites that take place to become comprehensive beneath, from our point of view are undoubtedly well worth checking out[…]

rechargeable vibrator

03rd, Mar, 21

rechargeable vibrator

[…]that will be the end of this report. Here you’ll find some websites that we consider you will enjoy, just click the hyperlinks over[…]

THC Cartridge

07th, Mar, 21

THC Cartridge

[…]very handful of sites that come about to become detailed below, from our point of view are undoubtedly nicely really worth checking out[…]

Pornhome XXX

11th, Mar, 21

Pornhome XXX

[…]although internet sites we backlink to beneath are considerably not associated to ours, we really feel they may be essentially really worth a go by way of, so possess a look[…]

safestore auto

13th, Mar, 21

safestore auto

[…]very couple of sites that happen to be comprehensive below, from our point of view are undoubtedly properly worth checking out[…]

safestore auto

13th, Mar, 21

safestore auto

[…]usually posts some really interesting stuff like this. If you’re new to this site[…]

apk for pc download

14th, Mar, 21

apk for pc download

[…]although web sites we backlink to beneath are considerably not connected to ours, we feel they may be truly really worth a go through, so possess a look[…]

free download for windows 8

15th, Mar, 21

free download for windows 8

[…]very handful of internet websites that take place to become comprehensive below, from our point of view are undoubtedly effectively really worth checking out[…]

safestore auto

17th, Mar, 21

safestore auto

[…]very couple of web sites that take place to be detailed beneath, from our point of view are undoubtedly nicely worth checking out[…]

divorce lawyer singapore

19th, Mar, 21

divorce lawyer singapore

[…]Every the moment inside a although we select blogs that we read. Listed beneath would be the most recent internet sites that we select […]

bigcanvas

22nd, Mar, 21

bigcanvas

[…]just beneath, are several totally not connected internet sites to ours, on the other hand, they’re surely worth going over[…]

order flexeril online

23rd, Mar, 21

order flexeril online

[…]Wonderful story, reckoned we could combine a number of unrelated data, nevertheless seriously worth taking a appear, whoa did one understand about Mid East has got extra problerms also […]

psilocybe cubensis grow kit usa

24th, Mar, 21

psilocybe cubensis grow kit usa

[…]we prefer to honor quite a few other world wide web websites around the net, even when they aren’t linked to us, by linking to them. Under are some webpages worth checking out[…]

Andre Nieri

26th, Mar, 21

Andre Nieri

[…]here are some hyperlinks to sites that we link to since we feel they’re really worth visiting[…]

buy cocaine online

26th, Mar, 21

buy cocaine online

[…]Wonderful story, reckoned we could combine a couple of unrelated data, nonetheless really worth taking a search, whoa did one particular study about Mid East has got a lot more problerms also […]

click here

29th, Mar, 21

click here

[…]The facts talked about inside the post are a few of the ideal accessible […]

Homepage designer

30th, Mar, 21

Homepage designer

[…]just beneath, are many completely not associated web sites to ours, nevertheless, they may be surely really worth going over[…]

Herbal incense

31st, Mar, 21

Herbal incense

[…]we came across a cool site that you simply may enjoy. Take a search when you want[…]

Herbal incense

31st, Mar, 21

Herbal incense

[…]below you will discover the link to some internet sites that we consider you’ll want to visit[…]

in the usa

01st, Apr, 21

in the usa

[…]always a huge fan of linking to bloggers that I love but don’t get a great deal of link love from[…]

Shoes

02nd, Apr, 21

Shoes

[…]here are some hyperlinks to web pages that we link to because we think they’re really worth visiting[…]

cryptocurrency news

04th, Apr, 21

cryptocurrency news

[…]we prefer to honor lots of other world-wide-web internet sites on the internet, even when they aren’t linked to us, by linking to them. Below are some webpages really worth checking out[…]

pharmacy in canada

05th, Apr, 21

pharmacy in canada

[…]we like to honor lots of other world-wide-web web pages on the net, even though they aren’t linked to us, by linking to them. Below are some webpages worth checking out[…]

virtual card buy

05th, Apr, 21

virtual card buy

[…]here are some links to websites that we link to because we assume they’re worth visiting[…]

virtual card buy

05th, Apr, 21

virtual card buy

[…]check below, are some totally unrelated internet websites to ours, however, they may be most trustworthy sources that we use[…]

buy arcade games online

06th, Apr, 21

buy arcade games online

[…]check beneath, are some totally unrelated websites to ours, having said that, they may be most trustworthy sources that we use[…]

high cube shipping container

06th, Apr, 21

high cube shipping container

[…]although web sites we backlink to below are considerably not related to ours, we feel they are actually worth a go by way of, so possess a look[…]

buy cbd oils for sale europe

07th, Apr, 21

buy cbd oils for sale europe

[…]Wonderful story, reckoned we could combine some unrelated data, nevertheless seriously worth taking a search, whoa did 1 learn about Mid East has got extra problerms too […]

Pharmacy in Canada

08th, Apr, 21

Pharmacy in Canada

[…]that may be the end of this write-up. Here you’ll obtain some internet sites that we believe you’ll appreciate, just click the links over[…]

buy delta 8

08th, Apr, 21

buy delta 8

[…]that would be the end of this article. Right here you will uncover some web pages that we assume you’ll enjoy, just click the hyperlinks over[…]

buy guns online

11th, Apr, 21

buy guns online

[…]just beneath, are several totally not associated web pages to ours, having said that, they are certainly worth going over[…]

Leave a Comment

To preserve code added to a comment you can wrap your code in short tags
by using [square brackets]:

  1. PHP use - [php] <?php code here ?> [/php]
  2. CSS use - [css] #code-here {} [/css]
  3. HTML use - [html] <div> code here </div> [/html]
  4. JS use - [js] $(".codeHere") [/js]