/ Published in: PHP
Wordpress by default wraps images in <p> tags, this kills that.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// stop wordpress from wrapping images in <p> tags function filter_ptags_on_images($content) { // do a regular expression replace... // find all p tags that have just // <p>maybe some white space<img all stuff up to /> then maybe whitespace </p> // replace it with just the image tag... } // we want it to be run after the autop stuff... 10 is default. add_filter('the_content', 'filter_ptags_on_images');