Forums

filtering the_content by post type (1 post)

  1. kwight
    Member
    Posted 3 months ago #

    What would be the best way to conditionally filter the_content by custom post type?

    This works, but I'm wondering if there is something simpler:

    add_action( 'wp', 'kw_endo_filter_the_content' );
    
    function kw_endo_filter_the_content() {
    	global $post;
    	if( 'faq' == get_post_type() ) {
    		remove_filter( 'the_content', 'wpautop' );
    	}
    }

Reply

You must log in to post.

About this Topic