Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

How to Open External Links in a New Window in WordPress

Last updated on by
Follow WPBeginner on YouTube
How to Open External Links in a New Window in WordPress

In WordPress every time an author wants to add a link in a post they have the option of selecting “open link in new window”. Although doing it manually is an option, there is a better way. By using this plugin you can have all external links open in new windows automatically even if someone forgets to check the box.

check box

All you have to do is go and download the plugin. There is no back end so you do not have to worry about setting anything up in the admin panel. Once you have activated it every link will be opened in a new window using JavaScript’s window.open()-function. Not only is this SEO friendly but the code is also XHTML Strict compliant. The best part about this plugin is that when Javascript is disabled in someones browser it doesn’t return any errors but just remains inactive.

Download the plugin Open External Links in a New Window.


Editorial Staff at WPBeginner is a team of WordPress lovers led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »
  • http://www.joaoleitao.com/travel/ João Leitão
  • Clare

    Can anyone tell me how to open a MENU item in a new window? I don’t see an option in the Edit Menus page. I have an external link in a footer menu , that I’d like to open in a new window.

  • Mike Cavanaugh

    I downloaded the plugin but all my links still open up in my wordpress page.

    On my side bar ads, I want them to open up in a separate page and leave my page open?

    Same for all the links in the “find a professional menu” I want people to go to their links/sites but keep my site open so they will have it in front of them.

    Help please?

    mike

  • demeyere

    I think it is much easier to just handle this in the jQuery for the whole site… and never worry about it again. (Substitute your own domain name for mine, of course.)

    // open all external links in a new window

    $(“a[href^=’http’]”).not(“[href*=’demeyere.com’]”).attr(‘target’,’_blank’);

    • wpbeginner

      @demeyere Again, the plugin above is not using target _blank to make sure that the site validates with XHTML strict. But yes, your code will do the job as well.FYI for others reading: Now anyone can simply make a plugin and call this snippet in the header. It wouldn’t make any difference in the load time between you manually putting in your header or calling it via a plugin into wp_head() hook.

  • easyP

    Hi

    In earlier versions of wordpress, you selected the text you wanted to link to and then hit the link icon on the dashboard.

    This opened a field in which you added the link.

    Worked fine.

    In latest wordpress versions, when I select the text and hit the link icon and paste in the link, the link appears at the top of the post – not surrounding the selected text.

    Am I doing something wrong?

    Plugin looks good but I’m trying to cut down on the number that I use.

    • wpbeginner

      @easyP It doesn’t work like that on our site. We are using 3.2.1. We select the text and hit the link icon, and it adds the link where it should. Are you using the Visual Editor or the HTML Editor?Also, any particular reason why you are trying to cut down on the number of plugins that you use?

      • easyP

        @wpbeginner

        Hi boys.

        Number of plugins – trying to cut down because of page load time.

        I love my theme, but it runs like a donkey.

        I use the html editor when writing posts and I’m using wordpress 3.2.1 but when I select the text and hit the link icon – the link forgets the highlighted text and appears at the top of the post / page!

        Any thoughts?

        • wpbeginner

          @easyP If you try to this trick without a plugin, you will end up doing the same thing. The impact of this plugin on your load time is barely noticeable.

        • easyP

          @wpbeginner

          Worth knowing that – thanks boys.

  • http://blogsnewsreviews.com/ AstroGremlin

    I just installed this plug-in. Kind of a funny name, Open External Links in a New Window, but certainly a great idea. Thanks!