Support

Account

Home Forums Front-end Issues Shortcode being wrapped with a paragaph tag Fix Reply To: Shortcode being wrapped with a paragaph tag Fix

  • Hi all, a year and a half later, I’m weighing in to add one bit of advice that worked for me:

    I kept getting </div></p> and similar phantom paragraph tags whenever I used shortcodes in an ACF WYSIWYG field. I extended @jt-mtl’s add_filter solution a bit and it worked for me.

    $array = array (
        '<p>[' => '[',
        ']</p>' => ']',
        ']<br />' => ']',
        '<p><div' => '[',
        '</div></p>' => ']',
        '</div><br />' => ']'
    );

    You could add any other markup to the array if you want to. Divs were all I needed, so I stopped there. Hope it helps!