WordPress Advanced Editor

Because I’m so content-focused with my blog (focusing largely on writing), I really love the advanced editor in WordPress, especially as of version 2.3. I do the vast majority of my writing live inside WordPress, where it saves every 30 seconds and I have a character map at the click of a button in the toolbar if I need to accent something. Links are easy to insert, I can pull pictures in easily, and it fits my purposes.

But a friend of mine is an actual web designer, and as such, he does a lot more on the visual and code side of things. The advanced editor in WordPress gives him quite a bit of grief, particularly when he switches over to the Code tab and enters some custom HTML, then goes to the Visual tab and sees that WordPress has “cleaned” his code, effectively breaking what he intended his post to look like.

The code cleaning feature in WordPress’s TinyMCE advanced editor is there to help users protect their theme. By ensuring that code is encapsulated and formatted “correctly,” it keeps WordPress pages from breaking. Unfortunately, it also often makes changes to one’s intended code, frustrating the user.

Stephen at Scratch99 has a great article about how to address this problem, and I suspect that Ryan will take the simple method of editing the TinyMCE javascript file and just turn off the “clean code” feature.

Turning the Advance Editor Cleanup Off

If you often enter your own HTML, but still want to use the Advanced Editor, then you might want to consider turning it’s cleanup option off. I stumbled upon how to do this on Thu Tu’s Smacking WordPress Editor.

Note: if you do this, the Advanced Editor will not do any cleanup. If you make errors in your HTML that break the theme, you’re on your own! If this happens you may not be able to edit the post anymore – the only solution may be to close the browser, go to the manage posts page again and delete the offending post.

To summarize how to turn off the advance editor cleanup:

Download the wp-includes/js/tinymce/tiny_mce.js file using an FTP program and use a text editor to change the following (near line 167) from:

this._def(“cleanup”, true);
this._def(“cleanup”, false);

Save the file, then ftp it back up to the server, overwriting the original.

Note: you need to delete your browser cache before this takes effect. For Internet Explorer, click Tools on the menu, then Internet Options, then Delete Files. For Firefox, simply press Ctrl+F5. For other browsers, sorry you’re on your own, but it should be straightforward to do.

As for me, I’m going to keep writing just like I always do. Now, if I could just find a decent way to format poetry correctly in WordPress…