• Why is it when I switch from the visual editor to the HTML editor and back that WordPress messes up my code?

    Here is what I insert:

    <img src="/wp-content/uploads/map-this-image.jpg" alt="map-this" width="480" height="717" usemap="#controlpanel" />
    
    <map name="controlpanel">
    <area shape="rect" coords="0,0,251,329" href="/wp-content/uploads/top-left.jpg" alt="top-left" target="_blank" />
    <area shape="rect" coords="251,0,480,329" href="/wp-content/uploads/top-right.jpg" alt="top-right" target="_blank" />
    <area shape="rect" coords="0,329,251,717" href="/wp-content/uploads/botom-left.jpg" alt="bottom-left" target="_blank" />
    <area shape="rect" coords="251,329,480,717" href="/wp-content/uploads/botom-right.jpg" alt="bottom right" target="_blank" />
    </map>
    
    What it ends up doing is inserting an opening <map name="controlpanel"> tag, and a closing </map> tag around every <area> tag like this:
    
    <img src="/wp-content/uploads/map-this-image.jpg" alt="map-this" width="480" height="717" usemap="#controlpanel" />
    <map name="controlpanel"> <area shape="rect" coords="0,0,251,329" href="/wp-content/uploads/top-left.jpg" alt="top-left" target="_blank" /></map>
    <map name="controlpanel"> <area shape="rect" coords="251,0,480,329" href="/wp-content/uploads/top-right.jpg" alt="top-right" target="_blank" /></map>
    <map name="controlpanel"> <area shape="rect" coords="0,329,251,717" href="/wp-content/uploads/botom-left.jpg" alt="bottom-left" target="_blank" /></map>
    <map name="controlpanel"> <area shape="rect" coords="251,329,480,717" href="/wp-content/uploads/botom-right.jpg" alt="bottom-right" target="_blank" /></map>

    What the heck is up with that and how the hell do I stop it from doing that?!?!?

    I am using the TinyMCE Advanced plugin but I don’t think it is the problem.

    [Moderator Note: Please post code or markup snippets between backticks or use the code button. Or better still – use the pastebin. As it stands, your code has now been permanently damaged/corrupted by the forum’s parser.]

Viewing 3 replies - 1 through 3 (of 3 total)
  • It looks like this plugin could help you out:
    http://wordpress.org/extend/plugins/preserved-html-editor-markup/

    Thread Starter TDP'sGM

    (@gmhilltop)

    Thanks Keith. My only issue with this is that that plugin MAY become unsupported in the future and the builder said he might not be updating it often due to personal circumstances.

    Am I to understand that this is a wordpress thing?
    If so, they should REALLY have a close look at fixing THAT!

    At the very least give Administrators the ability to insert code that doesn’t get stripped by WordPress itself, and leave that feature in place for people with lower levels of authority in that box.

    To the moderator ===> My apologies. I had scripting turned off and I didn’t notice the code button or the note below regarding code.

    Yeah, it is just a WordPress thing. The HTML view is really a hybrid of the visual editor and a true HTML editor. A lot of code will be stripped the moment you switch to Visual but if you never switch it, I’ve found that your code will usually stay in place.

    This plugin, Exec-PHP, hasn’t been updated in a long time but I use it regularly and find it very useful when I want to use code in a page:
    http://wordpress.org/extend/plugins/exec-php/

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WordPress messing up my HTML code!’ is closed to new replies.