How to Make Your WordPress Links Open In A New Window

How to Make Your WordPress Links Open In A New Window

If you want your links in WordPress to open in a new window/tab:

  1. Navigate to your WordPress Blog Entry or Page
  2. Click on the existing link or highlight the words you want to be linked
  3. Click on the Link Icon
  4. Change the Target option to: Open Link in a new window
  5. Click Update and then Update or Publish your blog entry/page.

How to make your WordPress links open in a new window.

To manually add the code to your HTML, use the target attribute with the value of _blank like this: <a href=”http://yourlink.com” target=”_blank“>Your Link</a>
Read more about the target attribute at W3Schools.com

12 thoughts on “How to Make Your WordPress Links Open In A New Window

  1. Mike

    I would like to know that too.
    Its Extremely annoying to do this in every single post. It kills so much time. Any ideas?

    Please someone….

  2. Dave Post author

    1. Open this file:

    wp-includes/js/tinymce/themes/advanced/js/link.js

    2. Look for this code around line 140

    lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang(‘not_set’), ”);
    lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang(‘advanced_dlg.link_target_same’), ‘_self’);
    lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang(‘advanced_dlg.link_target_blank’), ‘_blank’);

    3. Reorder so target_blank option is on top

    lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang(‘advanced_dlg.link_target_blank’), ‘_blank’);
    lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang(‘advanced_dlg.link_target_same’), ‘_self’);
    lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang(‘not_set’), ”);

  3. Christian

    Create a JS file with this as content:

    $(document).ready(function () {
    $(“.single_content A”).attr(‘target’, ‘_blank’);
    $(“.excerpt A”).attr(‘target’, ‘_blank’);
    });

    Then add this to the header file at the end of the script tags AFTER the jQuery include.

    <script type="text/javascript" src="/lib/js/links.js”>

  4. Roezer

    Dave’s Method worked but5 I would Really Like to Know how to Make All Dashboard Links open in a New Window. Mainly when I am trying to Understand a New WordPress Plugin for Example I would Like to Be able to Read the Instructions in One Tab and Input the Settings in another. Daves Method is Great for Editing Content I have not Tried Christians.