Title: change external link code inserted when adding new post: file?
Last modified: August 19, 2016

---

# change external link code inserted when adding new post: file?

 *  [cmiwebstudio](https://wordpress.org/support/users/cmiwebstudio/)
 * (@cmiwebstudio)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/change-external-link-code-inserted-when-adding-new-post-file/)
 * I want to be able to add external links the current system adds target=”_blank”
   which is not valid xhtml strict code. I would prefer it inserted onclick=”window.
   open(this.href);return false;” which is valid code. How can I modify this function?
   What file inserts this?

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Thread Starter [cmiwebstudio](https://wordpress.org/support/users/cmiwebstudio/)
 * (@cmiwebstudio)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/change-external-link-code-inserted-when-adding-new-post-file/#post-1253405)
 * I found a file at location:
 * wp-includes/js/tinymce/themes/advanced/link.htm
    wp-includes/js/tinymce/themes/
   advanced/js/link.js
 * this is the file that creates the code from the pop up menu that your insert 
   your url into the post, and choose whether you want it to open in same window
   or new window. I can see the javascript that does this toward the bottom of the
   js file. What can I change to do this? I dont want to add a plugin or add a javascript
   call to my pages to change on the fly or anything like that… i want the code 
   to insert the correct syntax.
 *  [mtw28](https://wordpress.org/support/users/mtw28/)
 * (@mtw28)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/change-external-link-code-inserted-when-adding-new-post-file/#post-1253407)
 * Here are two threads that discuss this– maybe one of them would work for you.
 * Solution using a Plugin: [http://wordpress.org/support/topic/312244](http://wordpress.org/support/topic/312244)
 * Another approach using javascript: [http://wordpress.org/support/topic/267704](http://wordpress.org/support/topic/267704)
 *  Thread Starter [cmiwebstudio](https://wordpress.org/support/users/cmiwebstudio/)
 * (@cmiwebstudio)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/change-external-link-code-inserted-when-adding-new-post-file/#post-1253410)
 * thank you. i understand those solutions but I dont want to add a plugin that 
   swaps out on fly, or additional javascript on each page. My solution is actually
   a lot better than those methods which is a simple onclick javascript action that
   requires no additional server calls on page load. I want tinymce, which is the
   behind the scenes WYSIWYG that is used for posting, insert the syntax of my choice
   rather than target=”_blank”. I know the files that do it, I just don’t know javascript
   well enough to know what to change.
 *  [shane-g](https://wordpress.org/support/users/shane-g/)
 * (@shane-g)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/change-external-link-code-inserted-when-adding-new-post-file/#post-1253423)
 * Hi,
 * Check with this plugin:
 * [http://wordpress.org/extend/plugins/sem-external-links/](http://wordpress.org/extend/plugins/sem-external-links/)
 * Thanks,
 * Shane G.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘change external link code inserted when adding new post: file?’ is closed
to new replies.

## Tags

 * [external links](https://wordpress.org/support/topic-tag/external-links/)
 * [links](https://wordpress.org/support/topic-tag/links/)
 * [_blank](https://wordpress.org/support/topic-tag/_blank/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 3 participants
 * Last reply from: [shane-g](https://wordpress.org/support/users/shane-g/)
 * Last activity: [16 years, 7 months ago](https://wordpress.org/support/topic/change-external-link-code-inserted-when-adding-new-post-file/#post-1253423)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
