I know this is an ancient problem that's been around since the onset, but it seems to have gotten much worse with recent versions of WordPress.
WordPress's visual editor totally reformats any html code that is entered into a post or page. Is there ANY way to prevent this from happening? it doesn't seem to matter what code it is, and I've even attempted wrapping the code in <preformatted> tags, but WordPress will strip those tags and completely rearrange the code.
The answer has always been 'don't use the visual editor'. (WordPress's take on the old joke, "Doctor it hurts when I do this"?) However, this is not at all practical. More than one person update some of the sites I use WordPress on, and on most of those sites, I'm the only one with any html knowledge at all.
PLUS, on some of those sites, WordPress REFUSES to open up a post edit in html mode. It will load the visual editor every single time, regardless of whether that post was first written in html. When it does so, it automatically screws up the code, so I have to recreate the post all over again. It's gotten so I'm keeping backups of all posts I might need to use custom code on (such as those containing paypal buttons or forms of any kind) so I can copy and paste the preformatted code into the page/post each time it's edited. When a team are working on something, and requesting changes a dozen times a day, this becomes major temper tantrum territory after a while.
There MUST be a way to make WordPress stop messing with code. It's been a problem with the software for so very long, and complained about so often, that you would think someone in developing would have made some effort to fix it by now.
Does anyone out there have a workaround???