Stop WordPress Wrapping Images In A “P” Tag

Question

I have searched high and low for a simple solution to this, but to no avail. WordPress keeps on wrapping my images in p tags and because of the eccentric nature of the layout for a site I am working on, this is highly annoying.

I have created a jQuery solution to unwrap images, but it isn’t that great. It lags because of other stuff loading on the page and so the changes are slow to be made. Is there a way to prevent WordPress wrapping just images with p tags? A hook or filter perhaps that can be run.

This is happening when uploading an image and then inserting it into the WYSIWYG editor. Manually going into the code view and removing the p tags is not an option as the client is not that technically inept.

I understand that images are inline, but the way I have the site coded images are inside of divs and set to block, so they are valid code.

0
Dwayne Charrington 4 months 0 Answers 8 views 0

Leave an answer