Remove Paragraph Tags From Images in WordPress

function filter_ptags_on_images($content){
    return preg_replace('/
\s*(<a>)?\s*(<img alt="" />)\s*(&lt;\/a&gt;)?\s*&lt;\/p&gt;/iU', '\1\2\3', $content);
}
add_filter('the_content', 'filter_ptags_on_images');</a>
The following two tabs change content below.

Md Jahed

Latest posts by Md Jahed (see all)

Leave a Reply

Your email address will not be published. Required fields are marked *