I've tried disabling WP's auto-paragraph thingy using

remove_filter ('the_content', 'wpautop');

but I am still getting my stuff wrapped in automatic <p> tags... What am I doing wrong?

Its at the bottom of a functions file. Its not in functions.php, but in a file that functions.php includes (and putting it in functions.php doesn't change the behaviour at all).

Update: var_dump( $wp_filter['the_content'] ); outputs NULL. How can I test why this filter isn't being run?


Had same problem, fixed with css:

  height: 0;
  margin: 0;
  padding: 0;
|improve this answer|||||

If you're using the TinyMCE Advanced plugin, try unchecking this advanced option:

Stop removing the <p> and <br /> tags when saving and show them in the HTML editor

Unchecking that and using the remove_filter ('the_content', 'wpautop'); code in my functions.php did the trick for me.

|improve this answer|||||

Your code is absolutely correct. You can try this snippet in template to ensure it is being removed:

var_dump( $wp_filter['the_content'] );

If it's not it may be that code never reaches your filter removal (return above it for example) or filter is re-added later by some other code.

|improve this answer|||||
  • 2
    or try changing the filter priority, default is 10 – onetrickpony Jan 12 '11 at 14:08
  • @Ambitious Amoeba not sure what you mean? Priority should match exactly for remove_filter() to work. – Rarst Jan 12 '11 at 14:17
  • yeah, but if you add a filter with priority 20, shouldn't you remove it with the same priority? maybe autop is added with a different priority... – onetrickpony Jan 12 '11 at 14:36
  • @Ambitious Amoeba I've checked the source and tested code, it is added without priority specified so default it is. – Rarst Jan 12 '11 at 14:43
  • var_dump( $wp_filter['the_content'] ); outputs NULL. I've tried grepping for wpautop but apparently none of the php files in wp-content contain this, apart from my line of code. – gillespieza Jan 12 '11 at 19:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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