Remove ‘p’ Tags from WordPress WYSIWYG Images

Published:
July 22, 2017 Last Updated:
August 21, 2017

The WordPress WYSIWYG content editor helpfully wraps embedded images with paragraph tags, this is kind of nice as the vertical spacing that you’ve applied to your paragraphs in your typography style guide, will then of course then be applied to your inline images. Whilst this is usually desirable, sometimes we simply may just want control over this ourselves.

Place the following snippet into your theme’s functions.php file to prevent this behaviour.