Hi,
So all of you must have used the link button in the WP editor to create links. Now the default link button makes your links open in the same tab. If you want to make your links open in a new tab, you have to add target=”_blank” to your a tag.
Now to do that manually everytime or use a text editor to manually edit (Ctrl+F, Ctrl+H) or whatever to search replace and add target=”_blank” could be a tedious job! Why do it when you can edit one file and automate it forever.
The file in question is quicktags.js and resides in “wp-includes/js” folder.
Open the file in a text editor and search for “function” till you come across “function edInsertLink”. This is the function responsible for inserting links to your posts.
Edit this function so that the corresponding part now reads as
edButtons[c].tagStart=’<a href=”‘+a+’” target=”_blank”>’
and save.
There you go.
Now your links will have target=”blank” as a part of them.
Or you can just download the file from here and save it in your wp-include/js/ folder.
cheers!
the anAlyst
Exactly the info I was looking for! Thanks!
hi, This method only changes if the links are added from the Link button in the wp post editor, I am creating dynamic links in one of my pages for pagination and _blank is added for the page links. Could you please provide info on where _blank gets added for those type of links.
the link to the page where i am encountering this problem is http://jazzpresentation.com/ppt-templates/email-templates
Thanks.
Hi Snehan,
How exactly are you generating the dynamic links? Are you using any existing plugin? Let me know which plugin you are using, then I can try to help.
Easy way to trouble shoot, go through the code of your plugin and look for “blank” in there. You will need to remove one or more of the blank or conditions.
Hope to help.
regards
Anshu Prateek
Hi Anshu,
Thanks for willing to help
. but i was able to figure it out after sometime. I had actually written the code myself manually and was not using a plugin. But the page permalink format was causing the links to behave as external links and _blank was added. So i had to do some changes to my code for wordpress to understand my link as an internal link.
Thanks again
Regards
Snehan Solomon