How to Disable WordPress’ AutoP

Have you ever needed to disable the infamous wpautop that WordPress automatically inserts into posts and pages?

Here’s a quick snippet of code that lets you easily manage it using custom fields. Add the below code to your functions.php file.

function disable_autop() {
	global $post;
	$disable_autop_var = get_post_meta($post->ID, 'disable_autop', TRUE);
		if ( !empty( $disable_autop_var ) ) {
		remove_filter('the_content', 'wpautop');
add_action ('loop_start', 'disable_autop');


On a Page or Post where you want to disable the wpautop from running, simply add a custom field that has the following:

The code above will validate to see if the custom field with the value of “disable_autop” exists and if it does, it will disable the wpautop functionality, letting you manage the HTML 100% on your own.

Enjoy :)


  1. By Ralston Vaz on

    Hey, Jonathan.

    This is such an elegant solution and just what my client needed to better layout their social media design giveaway page. I applied your solution as instructed and it solved problem I didn’t yet realize the autop feature was causing.


    Reply »


Leave a Reply

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