Support

Account

Home Forums General Issues Remove p around img Reply To: Remove p around img

  • It should work the same, you just need to change the hook it runs on

    
    // img unautop
    function img_unautop($pee) {
        $pee = preg_replace('/<p>\\s*?(<a .*?><img.*?><\\/a>|<img.*?>)?\\s*<\\/p>/s', '<div class="figure">$1</div>', $pee);
        return $pee;
    }
    add_filter( 'acf_the_content', 'img_unautop', 30 );