WordPress.org

Ready to get started?Download WordPress

Forums

change external link code inserted when adding new post: file? (5 posts)

  1. cmiwebstudio
    Member
    Posted 4 years ago #

    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?

  2. cmiwebstudio
    Member
    Posted 4 years ago #

    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.

  3. mtw28
    Member
    Posted 4 years ago #

    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

    Another approach using javascript: http://wordpress.org/support/topic/267704

  4. cmiwebstudio
    Member
    Posted 4 years ago #

    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.

  5. Shane G
    Member
    Posted 4 years ago #

    Hi,

    Check with this plugin:

    http://wordpress.org/extend/plugins/sem-external-links/

    Thanks,

    Shane G.

Topic Closed

This topic has been closed to new replies.

About this Topic