Fublo blog

Fublo is a web development company based in London, England. We are code specialists and you're reading news about our business and programming learnings.

WordPress Image P Tag Removal

| Comments

Screenshot of WordPress Stackexchange

This code was originally posted on WordPress Stack Exchange, in response to a question which we were also working on for a client project. We used the P tag removal so that images would rescale correctly in a fluid theme which we developed with Andy Taylor’s CSS Grid. The problem was that images were being wrapped in paragraph tags by WordPress’s ‘the_content’ filter and this code strips them off after they’ve been added. It’s a bit backwards, but does allow us to solve the problem without hacking the WP core.

WordPress Image P Tag Removal Mini Plugin

  • Original Gist - comment, feedback, download, etc.

  • Click on “View Raw” below for the PHP, ready for copy and paste.

Comments