Support » Fixing WordPress » Editor removing HTML code

  • Resolved IainPurdie


    Hi, problem I had in the past coming back to haunt me. I’m not sure is 2.3 (the version I upgraded from) did this and I just didn’t notice, but…

    I’ve created two HTML tags in my stylesheet:

    <imgl></imgl> / <imgr></imgr>

    They push images to the left and right of blog posts and allow text to flow round them with a small border. All simple enough. And they work, which is great.

    The inbuilt editor doesn’t seem to take them into account when I add them on the HTML tab then flick back to the WYSIWYG tab. What I’ve noticed (after editing an old post and republishing) is that if I load a page with this markup in, edit in WYSIWYG mode and republish, the aforementioned tags are stripped out.

    Not an “end of the world” thing, but a pain having to go through and manually add all the tags again.

    Anyone know of a solution?

Viewing 4 replies - 1 through 4 (of 4 total)
  • 1. Don’t use non-standard html tags, instead use css classes applied to your image tags.

    2. Never switch back and forth between the visual and code editor, doing this will only mangle your code.

    I thought i’d seen everything but making your own html tags? Now that’s just….uhhh.


    Hey people.

    Yeah, the tags thing was kind of the only way I could get the pictures to do what I wanted. They are part of the style sheet, and are an adaptation of the “IMG” tag within a certain style. Pardon my lack of the correct terms! I’m more the kind of person who delves into code and messes with it than reads books on how to do it properly 😉

    Ideally, I’d just use parameters in the standard img tags, but I found this to be the easiest way. You’re right, though – perhaps if I used a class within the img then the editor wouldn’t strip stuff out.

    Thing is, I can’t avoid popping between the two tags as my spellchecker (Firefox) will only function in the WYSIWYG tab, while I need to manually alter HTML from time to time. I did have a glance around after I posted this and eventually did find a few people with similar problems with the visual editor “tidying” code when it wasn’t required.

    I used to have nightmares with v2.3 and it’s wholesale destruction of “table” elements.

    But, yeah. I should look more into using a “class” rather than a wholesale new “img” wrapper.

    Just done my first major post after upgrading to 2.5.1 – and the left/right align in the image editor seems to do just what I want. I can now ditch the old imgl/imgr. Could mean a large editing session at some point to “correct” the old ones, bug looks like future posts will be a lot easier – and it gets rid of this problem (at least in this instance).

    Yay! 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Editor removing HTML code’ is closed to new replies.