views:

15

answers:

1

I've added the following to my wordpress themes functions.php file:

//disable wpautop filter
remove_filter ('the_content', 'wpautop');
remove_filter ('the_excerpt', 'wpautop');

Which strips out all those pesky <p> </p> tags wordpress wraps around everything!

However, I was wondering if there was a way to do this ONLY on non-single pages (eg: home, archive, category, author etc). I want to disable wpautop on everything except single posts and pages... possible?

+2  A: 
function get_rid_of_wpautop(){
  if(!is_singular()){
    remove_filter ('the_content', 'wpautop');
    remove_filter ('the_excerpt', 'wpautop');
  }
}

add_action( 'template_redirect', 'get_rid_of_wpautop' );

Add that to your theme's functions.php file.

John P Bloch