Skip to content

Instantly share code, notes, and snippets.

@dibakarjana
Created March 2, 2020 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dibakarjana/c3413e47254bf9c5af4a89649e1fc123 to your computer and use it in GitHub Desktop.
Save dibakarjana/c3413e47254bf9c5af4a89649e1fc123 to your computer and use it in GitHub Desktop.
remove_filter( 'the_content', 'wpautop' ); only for certain post types
//decide when you want to apply the auto paragraph
add_filter('the_content','my_custom_formatting');
function my_custom_formatting($content){
if(get_post_type()=='my_custom_post') //if it does not work, you may want to pass the current post object to get_post_type
return $content;//no autop
else
return wpautop($content);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment