Website Design, Development and Consulting
In: Daily
30 Jan 2009If you want your links in WordPress to open in a new window/tab:
Open Link in a new windowTo 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
11 Responses to How to Make Your WordPress Links Open In A New Window
Carla
April 6th, 2009 at 2:34 am
This information was just what I needed. Thank you.
How
August 11th, 2009 at 9:20 pm
how to make it default to all of your pages
Mike
April 14th, 2010 at 3:22 pm
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….
Cliff
June 1st, 2010 at 9:41 am
Me too…how to make it the default selection???
Dave
June 24th, 2010 at 1:25 pm
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’), ”);
Christian
September 29th, 2010 at 4:00 pm
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”>
Roezer
October 23rd, 2010 at 2:03 pm
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.
Paddle Guy Jason
January 6th, 2011 at 1:11 am
thanks for the tip, just what i needed fast simple advise.
James
March 24th, 2011 at 5:30 am
Thanks but I wish there was a way to specify to wordpress that all outbound links should open in a new tab
Dave
March 24th, 2011 at 6:59 am
Try one of these:
http://wordpress.org/extend/plugins/outbound-links/
http://wordpress.org/extend/plugins/target-blank-in-posts-and-comments/
Sustainability WA
April 6th, 2011 at 7:40 pm
Thankyou,
Just what I needed. So simple if you know where to look.