Support » Alpha/Beta/RC » MCE Editor stripping attributes and removing tags

  • Resolved tjsix


    The TinyMCE editor is stripping out attributes from tags, similar to how kses will attributes/tags for non admins. Also, it is completely removing certain tags as well, for instance if I type <a href="#"></a> in the HTML view and switch to the Visual and back, that tag gets replaced with   This shouldn’t happen as it’s perfectly feasible to have an anchor tag that would be styled via CSS and attached to a js handler.

    Is there a way to specify which attributes/tags are valid with the new media api so this can be avoided? I have multiple themes that tie into the media_send_to_editor function and to insert multiple different html tags with data & other attributes pertinent to front-end functionality.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator Andrew Nacin


    Lead Developer

    Can you pastebin your code? It got stripped here for security reasons. ASAP or it will miss the boat for 3.5.

    Moderator Andrew Ozz


    WordPress Dev

    “Old style” anchors have been fixed in core and should work in RC3. However the anchors require name and usually no href. <a href="#"></a> is a normal link with no linked text. Seems it is treated as an error at least in Chrome and Firefox (the browsers handle insertion of links in contenteditable mode).

    Andrew, I didn’t originally post any code but can post anything you’d like.. the part where I noted what it gets replaced with is just a non-breaking space..

    tjsix – First make sure you’re on the latest RC 🙂 <a href="#"></a> This is a test works for me on my test install, but if there’s specific code you were using, please post it on and link to it here so we can test too! 😀

    This still seems to be an issue in 3.7.1.

    If I type in <a href="#"></a> in Text mode then switch to Visual and back, that tag gets replaced with a non-breaking space &nbsp;.

    Happens on 3.8-trunk now too.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘MCE Editor stripping attributes and removing tags’ is closed to new replies.