WordPress plugin: LDB External Links

After my post on how to clean up the target=”_blank” in a WordPress post I decided to turn my code into a WordPress plugin.

WordPress is my CMS of choice but I also love XHTML 1.1 which means that the default way WordPress handles for opening links in a new window doesn’t validate. That’s why I wrote this plugin.

LDB External Links does exactly what you’d expect it to do. It searches your WordPress content for links with target=”_blank” and replaces it with a link with rel=”external”. Via an added javascript to your wp-head() it then re-adds the the target=”_blank”.


  1. Upload the folder `ldb-external-links` to the `/wp-content/plugins/` directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress
  3. Presto, Your done! No configuration needed.



  • Added a configuration page so you can choose the value of the rel attribute.


  • First version of the plugin.

6 Replies to “WordPress plugin: LDB External Links”

  1. Good work on the plugin, and I’m sure lots of people will find it useful.

    My only gripe (not with your plugin) is that it seems a mistake on the part of the people setting the standards when you have to use a loophole to allow standard behaviour (opening in a new window) in order to validate a document.

    Your document will validate with JS disabled, but as soon as you enable JS you’ve suddenly got an invalid document in the eyes of the browser. It seems to be more of a trick than a fix.

    1. I’ve never worried about validating with JS enabled. I feel like it’s comparable to adding nitrous to a sports car. When it’s off, there’s no reason you shouldn’t obey the law. However, the entire purpose of turning it on is to bend (and where applicable) break the rules.

  2. Thanks for the code

    But you could’ve used a different jquery solution. Instead of turning all the rel=”external” into target=”_blank” at the loading time, what makes your code invalid again, why not tell the browser to open all the anchors with a rel=”external” in another window, like this:

    $(function() {
    	$('a[rel*=external]').click( function() {
    		return false;
  3. How do I have to fill in the form with the Merchant ID and the rest to get the iDEAL payment method working in my WP E-Commerce?

    Greets Dennis.

    ps. If you’re Dutch please reply in Dutch

Comments are closed.