I’d like to stop WP from wrapping <p> tags around <div> tags in the TineMCE editor …
Here’s what I’ve got:
function filter_ptags_on_images($content) {
return preg_replace('/<p>([^>]*)<\/p>/i', '$1', $content);
}
add_filter('the_content', 'filter_ptags_on_images');
That removes all <p> tags around text but nothing that is wrapped in <p><div>text</div></p>.
I’d also like to know a solution if I have nested <div> tags like <p><div><div>text</div></div></p>.