All WordPress developers will know that the HTML editor inside WordPress is a complete joke. It rearranges everything, closes tags, and mangles all your code. This is due to 2 built-in WordPress modules, Auto P and Texturize. The 2 magical lines that will disable these modules and turn the HTML editor into a normal, functioning, pure HTML editor are these:
Open the theme’s functions.php file. Inside the PHP code, put:
[code]
remove_filter (‘the_content’, ‘wpautop’);
remove_filter(‘the_content’, ‘wptexturize’);
[/code]
That’s it! By the way, to turn the Visual Editor off, go to your User Profile and click the checkbox at the top.
doesn’t seem to work. does it need to be in a php tag? also would the_content need to be changed to the_post if used from a page.php template?
this autoformatting feature is so frustrating. so many extra closing divs and p’s!!
please help, thanks
Great solution! Saved me loads of trouble. However, it seems to be filtering out the p tags I added myself.
In case anyone comes by looking for the answer to the above question – yes, you need to put those between PHP tags, and no, you don’t need to change the_content to the_post.
where exactly are you supposed to put this code?
This will only get you so far. There are other functions that need to be disabled to prevent your HTML from being mangled. For instance if you switch between the HTML and Visual tabs while editing a page or post, the HTML will be greatly altered. I recommend using my plugin instead: Preserved HTML Editor Markup: http://wordpress.org/extend/plugins/preserved-html-editor-markup/
I appreciate with the your post.