WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want the remove wpautop filter working only on posts from my blog. Because at some pages i need the autop, and at some pages i need it to not be there.

I use the following rule and it is in my theme's functions.php:

remove_filter( 'the_content', 'wpautop' );

Because I only want it on blogposts I was thinking about an if statement, I searched the conditional tags page in Wordpress and found out I can use is_single .

But it doesn't work.

This is the code I use now.

if(is_single() ){
     remove_filter( 'the_content', 'wpautop' );

It is still wraped by an p.

And even if it would have worked, there is an other problem. That is that is_single effects ALL singles from post types. And I only want the single of a blog post(posts).

Anyone know how to fix it?

share|improve this question
up vote 1 down vote accepted

Generally it's not a common way to strip wpautop with remove_filter as it is native functionality of WordPress.

But if you want to : place the remove_filter() function right before the the_content() function on the pages/templates where you don't need the wpautop

<?php remove_filter( 'the_content', 'wpautop' ); the_content();?>

share|improve this answer
thank you, what worked :) – Maartje Jul 25 '13 at 13:53

I found it.

Really simple.

I just added the remove filter rule at the top of my document, above the header. So now i have

<?php remove_filter( 'the_content', 'wpautop' ); ?>
<?php get_header(); ?>
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.