How to auto insert target="blank" in wordpress!

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

Written on March 4, 2010