Support » Plugin: Advanced Editor Tools » How to stop HTML tags being stripped out in visual mode

  • Hello, I’ve discovered a feature in the new TinyMCE editor that I need to disable urgently.

    It seems that certain HTML tags are stripped out from the source text when switching to and editing in visual mode.

    Here’s what I entered into the text box in text mode:

    <a href="void(0)">
    
    <img />
    
    </a>

    Ad this what I get when I switch to visual mode in order to visually edit the text and layout:

    <a>
    <img />
    </a>

    The href and onclick tags have been completely stripped out.

    How do I prevent that?

    I’ve tried to check or uncheck various advanced settings, but it doesn’t seem to make any difference.

    Thank you

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Thread Starter gorish

    (@gorish)

    I’ve finally found a partial solution to this problem. I’ve looked at hundreds of forum posts where this same problem is discussed and was finally directed to this post this post that suggested a fix.

    Firstly, why is this even an issue? Who is responsible for deciding that the (standard?) WP editor(s) strip out important coding features like href, onclick, mouseover, etc.? Nearly all my WP pages include bits of code where icons get clicked or embedded videos are played, etc.

    Who can I contact in WordPress to address this issue? At the very least, there should be a configuration setting which lists all the tags that will get stripped / preserved when switching from text mode to visual mode, whether in the text editor or the block editor!

    Without realizing it, I’ve more or broken every page on my website by making a small tweak in the text and then only much later being told by a visitor that the functionality has failed. And now I’m having to painfully go through every line and try to figure out what the code should be – and be VERY CAREFUL NOT to enter visual mode to check the layout.

    It gets worse: if I subsequently edit some other page visually and then come back and edit a page with interactive elements (e.g. onclick) then the editor starts out in visual mode and instantly wipes out all the code. The only workaround is to keep separate text files for every page and edit them outside WP (without the benefit of checking the layout visually) and copy/paste them into the WP editor. What a palava!

    Secondly, my href tags are

    What is it about javascript or javascript:void() that makes this tag different from, say href=”#”? If I use the former syntax, it gets immediately stripped out, but if I use the latter syntax (with the Advanced TinyMCE Configuration plugin) then it’s preserved.

    Thanks

Viewing 1 replies (of 1 total)
  • The topic ‘How to stop HTML tags being stripped out in visual mode’ is closed to new replies.