This might be a stupid question, and maybe I've missed some best practices thing, but I've been having this problem with clients using sites on WordPress. Let's say we have a fairly complex page that requires some good amount of HTML code inside the page itself. We put it up and it looks great. Now, month later client wants to edit couple words there, goes in and edits them in Visual Mode, and of course all markup that we did is now screwed up, so stuff is all over the place.

What are the approaches we can use to handle cases like that?

3 Answers 3


One thing you could do is create page templates for complex pages and simply add the content through the editor, leave as little mark-up as possible in the editor.

Another thing that might help is using the editor style (activated with add_editor_style() in functions.php) and defined in editor-style.css so the client has a better sense of what's going to be displayed (if you mimic your theme pretty closely) right in the editor.

Add custom fields with descriptive names for information which needs to be displayed in a certain way, in a certain place, rather than lumping it in the main content. The simple fields plugin simplifies this a lot, permits repeatable fields and file uploads. It gives flexibility while avoiding letting your client shoot himself in the foot so easily. Or you could make your own metaboxes,etc.


One obvious, but probably not satisfactory, solution would be to disable the visual editor for these pages.

To be able to really keep editors off sensitive markup, you should create a page template, like Cronco suggests. If you find that you have several editable parts, you can store them as custom fields.

Unfortunately, editing these custom fields through the default admin interface would be as far from WYSIWYG as you can get. You can make it better by using Front-end Editor, which allows you to edit custom fields inline.

  • I've always been shocked that the recommendation by the WordPress Core development team is to disable the visual editor. Scribu is not the first to suggest that route. Even more shocking is that TinyMCE supports the editing behavior Alex is looking for, but WP just wantonly hacks the markup to shreds in oh so many breaking ways. Commented Aug 31, 2012 at 22:09
  • @MarcusPope: It's easy to bitch and "be shocked". Just offer a solution (which I saw you did) and let users decide which is the best via voting.
    – scribu
    Commented Sep 1, 2012 at 13:19
  • Wow, I'm sorry you took that so offensively. I was simply pointing out that it's odd for a company to offer a product, and then recommend disabling a significant part of the product designed for usability just because the product has a bug, instead of simply fixing the bug. It is easy to comment about that being shocking because most companies just fix the bug. But I wouldn't really call it bitching, I'd consider it customer feedback. I'm not the only customer who's given WP this feedback. And I certianly wouldn't tell my customers they're just bitching about it. Commented Sep 3, 2012 at 17:59
  • @MarcusPope WordPress is not a product of Automattic and you are not a customer. WordPress is an open-source project and you are one of it's (power) users. There's a huge difference between those two scenarios.
    – scribu
    Commented Sep 4, 2012 at 11:47
  • Also, this really isn't the place to debate this ancient topic. I sure wish there was a canonical blog post or trac ticket I could point you to.
    – scribu
    Commented Sep 4, 2012 at 11:51

You should definitely use a plugin I wrote instead of going through the hoops and limitations recommended in the other answers.

I already answered this similar question: https://wordpress.stackexchange.com/a/48832/10127

Here's a direct link to the plugin: http://wordpress.org/extend/plugins/preserved-html-editor-markup/

Switching between visual and html tabs will not drastically alter your markup, and end users can still use the visual tab, making modifications to the content, without changing the general structure of the html. Be sure to read the entire readme file before deciding if this plugin is for you, but it definitely sounds like what you're looking for.

  • That will preserve the markup, but how will it protect sensitive HTML from being edited by users?
    – scribu
    Commented Sep 1, 2012 at 13:19
  • It does it in the best way I've seen to date. I'm not saying it's perfect, but it works pretty well. Editing content will only alter the inner text of the active element. So styles and and structure will be preserved. Content additions will repeat the previous parent block element if one exists, preserving the previous structure. List items are accounted for as well as other structures. Users needing to start new posts or pages can copy and past html from one to another and resume editing in the Visual tab. Commented Sep 3, 2012 at 18:03
  • And in my experience even the newest of users can quickly learn to copy sub sections of html if they need to do something more complex with their edits. Commented Sep 3, 2012 at 18:06
  • Thanks for the explanation; I didn't know TinyMCE did that.
    – scribu
    Commented Sep 4, 2012 at 11:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.