• Resolved sweyhrich

    (@sweyhrich)


    I’ve been including the HTML code from my Amazon Affiliate lookup at the end of posts that I make to my WordPress site. I switch from “Visual” to “HTML”, enter the code (enclosed between <div> tags), and save it. But if I switch back to “Visual”, make other edits, and then save it again, the Amazon <iframe> data between those <div> tags disappears. If I save it in HTML mode and don’t mess with anything again, it will stick.

    How can I make WP stop removing code I’ve specifically put in?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Switching back and forth between the visual and html editors will mangle your code. The visual editor is not a preview tool and is only meant for people who do not want to add their own code. If you will be adding any code, disable the visual editor by deselecting “Use the visual editor when writing” in your profile.

    This is one of the (few) things about WordPress that could do with some work for future releases. I share your frustration (but can’t help, sorry).

    Thread Starter sweyhrich

    (@sweyhrich)

    Ah, so it’s not just a failure to understand some rules. Thanks for the information.

    Until I know better how to enter some code for my posts, I’ll have to continue to use the Visual editor, and then just leave it in HTML mode when I’ve got the heavy lifting done and I’m back in familiar territory, HTML-wise.

    TFG, this was making me crazy. In my case I write a lot of code examples and was trying to get some inline javascript to work.

    I already use the WP Unformatted plugin to prevent smart-quotes and automatic formatting to screw things up.

    Finally figured out it was WP trying to help:
    Settings > Writing >
    Uncheck WordPress should correct invalidly nested XHTML automatically

    I already have this unchecked and I cannot insert the iFrame code from Amazon. Really, this is nuts.

    Right there with you. I’m trying to set up pages for clients to edit on their own once the site is done. I can’t do it if editing in Visual mode strips the code, because the whole reason I’m using WP in these cases is that the clients are noobs who can’t code a lick. They’re undoubtedly going to use the Visual editor. If there was a workaround for this I would ADORE it, because it would open up so many more formatting possibilities and save me the time spent trying come up with my own. It absolutely needs to be solved in future releases.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘WordPress, stop removing my HTML code!’ is closed to new replies.