Default Links to Open in New Window - i.e. Target = _blank
When I create links within the Admin for my site/Blogroll (i.e. not in a post), 99.9 times out of 100 I want the link to open in a new window. Yet, if I forget to set this option it defaults to _none and opens in the same window.
To make it worse, all of the default WordPress links are also set to open in the same window. If I choose to keep these links, I have to edit them all one by one to open in a new window else risk losing visitors.
Please default this setting to "_blank" in the Admin.
There are several reasons why it's hardly likely the target will be set to _blank by default, f.e.:
- it's considered a bad practice and less accessible for users (although I respectfully disagree)
- the target attribute is not XHTML Strict valid
But there are several plugins, f.e. one I wrote, which will solve your problem and automatically opens all external links in a new window.
If anything, let's get rid of the target setting altogether and use the browser default (opening in the same window).
If the user wants to open it in a new window then they can easily do that on their own, without it being forced on them. In my experience website owners usually want to force links in new windows because they're worried about losing traffic, but that's the wrong way to handle it. You should build an audience by creating good _content_, not with annoying tricks.
I have a plugin at http://thisismyurl.com/downloads/wordpress/plugins/external-link-to-new-window/ that will do it for you. It opens external links into a new widow, gives you the choice to include an icon or a nofollow attribute.
If you want, you can pull it apart and put the relevant code into your functions file as a default.
I am sorry but I find most relevant people here to solve my query. I tried posting it many times but no one is replying.
Actually my website's all links started opening in new window. I had deleted and deactivated all the plugins but its still happening the same way.
Link to website http://www.topgradepapers.com
when you click on any link either external or internal it opens in new window.
And another annoying this is that it happens only in Firefox and Chrome. Its not happening in the IE or opera.
Please help. Thanks :)
Mex Ale - The support forums are in http://wordpress.org/support
This forum is for ideas and suggestions to improve WP :)
I too would like the option to set my default to opening in a new page. Of course I would like to keep users on my page, however I think it is courteous to the user to open in a new window. Since our site has dozens of links that are updated frequently, keeping the top page open allows users to easily refer back to the page with other links.
I will be investigating some of the suggestions posted above.
Since I first posted this request, I've just started adding this little snippet of JQuery to launch all external links in new windows:
return this.hostname && this.hostname.replace('www.','') !== location.hostname.replace('www.','');
If you can give me a little more guidance I want to give this a try. Where does this code go? Is it in the CSS stylesheet?
Guys above: I don't want you to change WordPress defaults to suit just my needs. I am, however, wishing there were a way I could set the link defaults to suit me in MY own WordPress installations.
Christopheross Thanks but as with shedonist's code, I am not enough of a programmer to make use of the code without a bit more guidance.
RSS feed for this topic
You must log in to post.