I have a custom snippet that I want to support all the filters added to the_content—like shortcodes, wptexturize and the like, so I do this:
$template = apply_filters('the_content', $template);
The problem is that it causes a
<p> and a
</p> at the end of the snippet when used inline, probably caused by the wpautop function. How can I still apply "the_content" filters, while escaping the added paragraphs?
Another option is to add specifics filters manually, but many of those are added by other plugins so I may not keep track of them.