I’ve spent about half a day figuring this out, so I thought I’d share this rather simple solution.
I have a shortcode with content ([kvl_inset]content[/kvl_inset]) that was causing problems with wpautop. The shortcode is replaced by an <aside> block, but depending on the context, there would either be a stray </p> or <p> in the output of the_content(), or the opening or closing <aside> would be wrapped in a paragraph tag.
Apparently, this is because the wpautop filter is run before the shortcodes filter, which messes up tag nesting.
The rather simple solution that solved it for me was to change the priority of wpautop in functions.php, like this:
add_filter( 'the_content', 'wpautop',20 );
- The topic ‘Getting shortcodes with content to play nice with wpautop’ is closed to new replies.