i'm using wordpress 4.2.2 , every time add image wysiwyg wraps output image in paragraph tag. need strip out these tags. seem find online 2011 plus doesn't seem work.
i have tried putting things in functions.php like:
function filter_ptags_on_images($content){ return preg_replace('/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(<\/a>)?\s*<\/p>/iu', '\1\2\3', $content); } add_filter('the_content', 'filter_ptags_on_images'); nothing seems work. how can accomplish this.
btw using acf pro's wysiwyg , jointswp starter theme , images not wrapped in link tag if makes difference.
since you're using advanced custom fields, should able use get_field(), turn off formatting:
echo get_field('myfield', $post->id, false); read more get_field() in acf docs.
you can remove acf implementation of wpautop doing following in functions.php:
remove_filter('acf_the_content', 'wpautop');
Comments
Post a Comment