Support » Fixing WordPress » HTML Code Reformatted by Visual Editor

  • 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???

Viewing 14 replies - 16 through 29 (of 29 total)
  • I agree with LDMartin’s response.

    However, If you have your own administrative account on the site, each time you log into your own account, the posts will open in the editor you last used when you logged out. I have noticed when I go into a client’s site with their login I am often starting out in Visual Editor and have to do what LDMartin suggested to keep from messing up the code.

    I am looking forward to trying some of the other workarounds, plugins mentioned. I do wrap some shopping cart code with Raw HTML tags with the Raw HTML Plugin on one of my accounts and that works well, but is not practical for the whole post because the client cannot access any of the content.

    DD you were perfectly clear in your explanation…

    Thread Starter DragonDreamz

    (@dragondreamz)

    I really appreciate everyone’s responses. There must be something wrong with my main site’s WordPress installation then, because none of the above has worked for me (have been trying every suggestion, including the upgraded editor plugin listed above–which just disabled my visual editor completely when activated). Regardless of which editor I used last on an post, all posts automatically open to html when I log back into the site. The site is way too involved and complicated to do a complete wipe and reinstall. I guess I’ll just have to live with it. šŸ™

    Thanks, everyone.

    I think I found a solution for this problem. I downloaded the most popular MCE at the moment: TinyMCE Advanced (http://wordpress.org/extend/plugins/tinymce-advanced/)

    Inside the options, at the bottom of the page, there’s a box that says “Stop removing the <p> and <br tags when saving and show them in the HTML editor”

    I haven’t tested it extensively yet, but so far it has worked.

    If you haven’t found the solution by yourself yet, I hope this helps!

    Hey @dragondreamz I understand your frustration, I’m the author of the Preserved HTML Editor Markup plugin referenced by @fudogz above. You mentioned that you tried all of the suggestions made above, but @fudogz did place the link at the end of his post, so I just wanted to confirm if you tried my plugin?

    The wordpress platform will actually load any post using the tab that was last selected during a save. So if you, or someone else is editing a tab in visual mode, all subsequent edits will load in visual mode until you save in HTML mode. If it isn’t doing that then there is a plugin that is altering the default behavior šŸ™

    I know you found a workaround, but if you tried my plugin and it didn’t work for you I’d really like to find out more about your setup to see if it’s a problem I can fix. Just add a support request to my plugin page – http://wordpress.org/tags/preserved-html-editor-markup?forum_id=10.

    Thanks!
    -Marcus

    Oh, and glad to hear the plugin is helping you out @fudogz!

    Thanks for the useful plugin – works a treat.
    —–

    @ DragonDreamz

    My set up is these two plugins:

    http://wordpress.org/extend/plugins/preserved-html-editor-markup/

    http://wordpress.org/extend/plugins/ultimate-tinymce/

    I have html editing turned OFF in wordpress. This means that that tab can never be opened, so it will never be open upon re-logging into wordpress.

    My WYSIWYG editor is then Ultimate TinyMCE which give me more options than the stock wordpress editor. One of those options is the CodeMagic html editor, which I use instead of the stock wordpress html editor (that is now turned off by default). This editor is cleaner, easier and more like a traditional code text editor to use. I use “preserved-html-editor-markup” to further help in keeping the code in-tacked between WYSIWYG and HTML editing.

    Hope this helps

    cheers

    Thread Starter DragonDreamz

    (@dragondreamz)

    Thanks everyone, for the suggestions. Unfortunately, nothing I have tried has worked and I seem to be the victim of some sort of cascading failure, as I now cannot install any plugins at all, and many of my WordPress features are failing. My backups no longer back up, and although I can post, and I can switch to the visual editor when I wish, no matter what editor I use (I was unable to install both of the plugins above, but thank you for trying to help), every post and page will always open in html mode. I’ve tried shutting down all plugins and switching to the default theme, to no avail. Same problems persisted.

    I’m now even having trouble logging in to my Dashboard. It eventually gets there but takes forever for WordPress to respond to even the most innocuous click of the mouse.

    My income is strongly dependent on my site being functional reliably, so I’ve been putting off and dreading the thought that I’m going to have to totally wipe WordPress and reinstall it from scratch. Especially since I’ve been unable to do a reliable backup!

    “Don’t wait till you get home. Shoot me now.” LOL

    I really do appreciate everyone’s efforts to help!

    Thread Starter DragonDreamz

    (@dragondreamz)

    Later That Day….

    I may be starting a new thread for this problem, as it has obviously gone way beyond the issue in the topic heading.

    I have spent all day doing a full backup (manual since my plugins are failing right and left) of my WordPress installation and my databases. (I did have a lot of trouble backing up the databases and am still not sure if the file I finally got to download is complete, to be honest). I then did a complete manual reinstall of WordPress, keeping only my Content subfolders intact.

    The same issue with the html/visual editor still exists. If I write a post in Visual, it immediately switches back to html as soon as it is saved/published, and every post, however written, switches back to html when it’s reopened for editing.

    I WAS able to install and activate Ultimate-TinyMCE but when I went to the settings page, just as with other plugins I’ve attempted to install, the settings page was messed up (one plugin programmer said that the .css files are not loading…?) and I was unable to change any settings.

    I’m about ready to give up on WordPress at this point.

    Again, I thank you all for your efforts to help.

    Thread Starter DragonDreamz

    (@dragondreamz)

    And the last update from me (with apologies for being a pest, LOL!): After emptying my browser cache for the second time and doing a complete reboot of the computer, it does appear that I now have normal visual editor function. However, I still cannot install any new plugins. I shall be opening a new help topic, however, as this one has veered too far off course.

    Thanks for the great plugin MarcusPope! I had a big problem with wordpress tinyMCE visual editor deleting my rich snippets microformats tags. It works great!

    Experienced the same annoyances as DragonDreamz. Even just the removal of the <p> tags in HTML view is such a stupid thing. Looks like TinyMCE Advanced fixes that though.

    MarcusPope’s plugin sounds great too. Thanks for posting that.

    This problem becomes incredibly frustrating when you’re using a template that uses advanced HTML markup in the page/post body. It’s such a simple thing to fix by TinyMCE/Wordpress – being a Joomla user, which had this issue covered years ago, I thought WordPress would be all over it. Apparently not.

    We can’t complain though – WordPress is free šŸ˜‰

    Thank you fudogz for mentioning the Preserved HTML Editor Markup here – works so well for me.
    And thank you MarcusPope!

    Preserved HTML Editor Markup worked for me! Real Easy.!!!
    The Ultimate TinyMCE made not difference.
    WP 3.41

    Here it is 21st of July 2012 and I am having this problem with installing PayPal code into WP. Same issues – just another day… Should be easy to just add code within a script like GoDaddy’s website’s and move on. But, I am a lay person and not as savey as the rest on this site – but there should be an easy fix – Has anyone found it yet?

    Try marcuspope’s Preserved HTML Editor Markup plugin. That should allow you to paste the PayPal HTML in to the HTML tab of your post/page. For an easy intsall from within WordPress – go to Plugins > Add New, then search for:

    Preserved HTML Editor Markup

    Install it, and make sure you Activate it after the install is complete.

Viewing 14 replies - 16 through 29 (of 29 total)
  • The topic ‘HTML Code Reformatted by Visual Editor’ is closed to new replies.