• I’ve noticed when pasting javascript into the HTML editor of a post, switching to visual mode and back to HTML mode results in the javascript being stripped out and replaced with a space?

    The javascript in question is nothing complex, simply in the form of…

    <script type="text/javascript" src="http://www.some.com/page.php?id=1"></script>

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Switching between HTML and Visual editors is a bad idea. It breaks things and never works. If you really need to be able to insert JS, or any special code, you must use the HTML editor OR make a shortcode.

    Thread Starter bobred

    (@bobred)

    Thanks, i’ve since wrote a plugin that will allow me to add such JS via shortcodes. However i’ve also noticed that the editor strips comments out of html, i’m sure the editor wasn’t this bad in previous versions of WP?

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

The topic ‘editor breaks embedded javascript’ is closed to new replies.