shortcodes getting wrapped by P-tags

I’m pretty sure this is a wordpress thing, but I tried a couple of functions.php hacks and it is still adding p-tags to shortcodes within BB text editor and might have interfered with the page builder functionality.

any ideas on "alder"natives?

thanks

Hey Wasana,

Could you try placing your shortcodes on an HTML module and see if that makes a difference?

Ben

Hi, thanks for prompt reply.

shortcodes in HTML don’t get the added p-tags so that is a practical workaround but less than ideal.

that will solve the current issue, but would hope for a text editor solution at some point

thanks

Hey Wasana,

As you’ve said earlier, it could be WP that’s adding the p tags. We’re simply using the same Text Editor as WP. Do you mind using your shortcode inside the native WP editor and see if you get the same thing?

Ben

Agree it is WP being unruly, the common hacks weren’t working or were messing with the page builder.

I’m going to say that using the HTML module is going to be acceptable - was just hoping you might have had a functions.php trick on hand, but at this point don’t need to make a project of it.

let’s mark this as resolved unless anyone has a way to do it.

thanks

Hey Wasana,

Just wondering if you tried disabling the wpautop filter?
https://codex.wordpress.org/Function_Reference/wpautop#Disabling_the_filter

Ben

Hi - I tried a couple of methods, and one seemed like it messed up the Page Builder, columns and modules were acting odd during edits. Couldn’t tell you which one at this point however.

Hi Wasana,

I just wanted to chime in here to say that I have not encountered shortcodes getting wrapped in p-tags, either in the WP editor or within a BB text editor.

Just tried it on a local and live site using shortcodes for WooCommerce and Gravity Forms. I will mention that the WC shortcode did not display at all once saved in the BB text editor but the page displayed properly on the live page. The GF shortcode displayed the form once the BB text editor was saved. Going back in to view the codes, and there were no p-tags in the ‘Text’ tab of the BB editor.

Which shortcodes are you using for this?

The sites I am testing this on are using Dynamik Website Builder for the theme.

UPDATE: Just tried the BB Child Theme and TwentyFifteen and yep, no p-tags :slight_smile:

Are you possibly using a plugin such as:
https://wordpress.org/plugins/tinymce-advanced/
That does wrap <p> tags (and others)
(In this particular plugin there is a setting to turn that feature on and off!)
Dave

I really appreciate the help.

At first I simply assumed it was WP doing this because it used to be a common complaint, and I could either disable wpautop globally in my user profile settings or more targeted using some functions.php.

However using the wp post editor does NOT wrap shortcodes in p-tags.

Since other beavers aren’t complaining about this, it must be caused by something unique on my site like another plugin - but identifying it is a matter of diminishing returns while I race to complete my overly long list of projects.

For now I am going to accept simply using HTML module for shortcodes - and if/when I discover the root cause I will post an update.

Thanks again.

Hey Wasana,

That would be awesome! Do let us know if ever you figure out what is causing it so we may take a look. :slight_smile: For now, I’ll just mark this as resolved. Enjoy!

Ben