Remove wpautop from all posts/pages except my custom post type

My whole theme uses remove_filter( 'the_content', 'wpautop' ); which strips the p tags and lines breaks from the output of the WYSIWYG. I have a custom post type events that I would like to bring back the auto p tags and br tags for, but JUST on that custom post type. Is there a way to make sure that filter doesn’t get removed on events.

2 Answers
2

You can perform a conditional test against the current post type, like this:

if ( 'events' != get_post_type() ) {
    remove_filter( 'the_content', 'wpautop' );
}

Leave a Comment