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!
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.