WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] MCE Editor stripping attributes and removing tags (8 posts)

  1. tjsix
    Member
    Posted 1 year ago #

    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.

  2. Andrew Nacin
    Lead Developer
    Posted 1 year ago #

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

  3. Andrew Ozz
    WordPress Dev
    Posted 1 year ago #

    "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).

  4. tjsix
    Member
    Posted 1 year ago #

    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..

  5. 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 pastebin.com and link to it here so we can test too! :D

  6. David Gwyer
    Member
    Posted 8 months ago #

    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;.

  7. Happens on 3.8-trunk now too.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.