I removed wpautop
from my theme:
function disable_linebreaks($content) {
remove_filter ('the_content','wpautop');
return $content;
}
add_filter('the_content','disable_linebreaks',1);
But now, when switching between HTML and Editor ALL p-tags disappear, even the ones I coded myself.
What I want is just to prevent WordPress from adding empty <p></p>
– Code. Basically I’m happy with wpautop
, it’s just that sometimes it’s too much (For example around images. There’s always an empty p before every image).
If what you want is really only
and you’d be happy with removing those after post retrieval from the database, then
will do.