WordPress html code rewriting and the frustration it causes

I really hate it when an application automatically rewrites the code I provide without asking me first.

To turn this ‘feature’ off in WordPress:

As admin user select Appearance > Editor > Theme Functions (functions.php) and append to the end the following

remove_filter( 'the_content', 'wpautop' );
remove_filter( 'the_excerpt', 'wpautop' );

You probably also want to disable the ‘visual’ editor: as admin user select Users > user_to_be_modified > Edit > Personal Options > Visual Editor and make sure there is a tick mark next to Disable the visual editor when writing, then click Update User.

Update

As I have just learnt, the above will fix most HTML rewriting problems, but only if you are logged in as the admin user. For other users, e.g. ones with author role, WP will still mess up their carefully hand crafted HTML posts.The solution to this problem is to install, as admin, the User Role Editor plugin. Once the plugin is installed and activated, start it, select the user you want to give additional privileges to, put a tick mark next to unfiltered_html and click on Update. For details of the plugin, follow this link.

Leave a Reply

Your email address will not be published. Required fields are marked *