Identify External Links
About
This plugin will add a special CSS class to all links in your entries and in your comments that go to external sites (sites other than your site). For more complex external link identification needs, check out Link Indication.
Download
Instructions
Copy and paste the text. Save it in a file named identify-external-links.php. Make sure there are no spaces before the opening <?php or after the closing ?>. Activate it from within the WordPress admin interface. You can then use a.extlink { } in your CSS to style it.
You can also edit a setting in the top of the plugin to add target="_blank" to external links, so that they open in a new window (this is from popular demand… please note that this is an annoying thing to do to your readers.)
Versions
- Version 1.3 Filter priority has been upped to 999 to get around some issues with markup plugins… option added to do
target="_blank" - Version 1.2 Doesn’t apply
extlinkclass if there is an image within the link - Version 1.1 Works for subdomains now (thanks h0bbel!)
- Version 1.0 Initial release


you could do a find/replace in the database, or use a filter to remove it on-the-fly…
$text = str_replace(' target="blank"', '', $text);Hi I found a bug in Version 1.3
Your current code recognises two types of hrefs:
href=”http://www.mysite.com/mypage.htm”
-and-
href=”http://www.othersite.com/theirpage.htm”
I modified the code to deal with a type of href that I use on my site, which is
href=”/mypage.htm”
I would like to share the bugfix. Where can I post it?
Hi, I’m having a problem getting the plugin to work with external links that are in a list. It doesn’t seem to add the â€extlink†class to the links.
Any help would be appreciated.
Cheers.
re: my previous post.
I forgot to mention that it’s only in the feedback section that it doesn’t seem to be working.
http://goodbyepolar.com/2006/11/04/external-links-in-a-list/
thanks!
works like expected
that’s my style: .extlink:after { content: “279A” }
shown eg. here
Boah, really great job! Thanks
Great plugin - thanks; however I seem to be having a slight problem with it… most of my links are working fine, but the plugin doesn’t seem to identify anything with a .co.uk domain name as being external to my site (www.markwilson.co.uk/).
As I have a UK-based website it’s a bit of a problem! Strangely it’s OK with .me.uk and .com.au so it’s not all two-level TLDs that cause an issue.
Thanks for any advice that you can give?
Good site! I found in google.com +
I hate to sound like a broken record but it works great.
Heading right over to install
Vijay
Well, i still like the plugin however it’s also good to use 301 Redirect
Well, the plugin ad a class=”extlink” but no target=”_blank” even if I set it “true” in php file
Any hints?
Very good blog thank you..
youtube kraloyun oyun youtube oyunlar güzel sözler youtube
thanks
Thanx… its work!
silk floral arrangement
ducky rubber
awning canopy
bob greenes total body makeover
pussycats doll
miss kittin
lakewood fan
mortar pestle
brighteyes
gsp of illinois
Thanks. I will install to see how it works. =)
well done
If you want to know the external links that exist in internet to your site or to any site you can use this webmaster online tool:
Who links to me
[url=http%3
[url=http:/%2
<a href=http:
[url=http://www
[url=http://de.g
thanks
Thank its work!
Thanks, great post!
This plug-in is great!
But..it doesn’t add ‘target=”_blank”‘ to the title linked to the external link.
It’s common that syndicated article’s(by auto-feeder) title is linked to the external site(to the original source) and it’s needed esp. when the contents are excerpt; so the user can go see entire contents from the source site rather than seeing full post which is just the same excerpt…
Could you update the code or let me know how to add that that feature?
Thank you in advance!
I’m submitting a fix for the target “_blank” issue. It actually only opens links in a new page with if there is an image. Add the following to make it work with text too.
Change your parse_external_links function with this one:
function parse_external_links($matches){
global $txfx_iel_use_target_blank;
if ($txfx_iel_use_target_blank)
{
if ( wp_get_domain_name_from_uri($matches[3]) != wp_get_domain_name_from_uri($_SERVER["HTTP_HOST"]) )
{
return ‘‘ . $matches[5] . ‘‘;
}
}
if ( wp_get_domain_name_from_uri($matches[3]) != wp_get_domain_name_from_uri($_SERVER["HTTP_HOST"]) )
{
return ‘‘ . $matches[5] . ‘‘;
}
else
{
return ‘‘ . $matches[5] . ‘‘;
}
}
(This plugin still also appears to only add the class attribute to text links. So another fix is probably needed if it is desirable to have the class on images and text links too.)
thanks
http://www.internetreklam.gen.tr
thank you!
thanks
http://www.gebzeekinemlak.com
thank you.
http://www.yasamnet.com.tr
thank you
thanks
http://www.sistemweb.net
thanks…
thanks
Hi,
I installed this on a customers blog for them ..
I set: $txfx_iel_use_target_blank = true;
I activated the plugin, but it appears to have no effect?
Wordpress is V.2.2.2
Any Ideas? It can be seen at http://www.gatewaydiscovery.com
I’m having the same problem as #190 - activated but it doesn’t seem to affect anything (looking to open new window). Any ideas? Thanks.
Preved dyatlam!
thanks
thanks so much
thanks.
http://www.tuzlanakliyat.com