How to disable wpautop on specific Page(s) in Genesis

Posted on Leave a comment
5/5 - (214 votes)

WordPress has a useful feature called wpautop (WordPress Auto Paragaphs) that automatically adds paragraphs and line breaks when WordPress editor is used in Text view. There may be times when you need to add a lot of HTML code in the Page editor and find that WordPress is messing up the output by adding unwanted p tags in the rendered HTML on the front end.

It is possible to disable wpautop from specific Page(s) in Genesis by adding the following in child theme’s functions.php:

// Disable wpautop on selected Page(s).
add_action( 'genesis_entry_header', function () {
	// if this is not FAQs or Team Page, abort.
	if ( ! is_page( array( 'faqs', 'team' ) ) ) {

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

where faqs and team are the slugs of Pages on which wpautop should be disabled.

Leave a Reply

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