I've been ripping my hair out for hours and now I'm almost bald! :p Any time I try to insert any shortcode into the visual editor (on its own line), it wraps them in <p></p> tags. This happens when I save or switch to the text tab, even after I've manually removed the <p></p> tags. Wordpress is basically treating everything as text. It affects both default WP shortcodes and custom ones. Examples:

[gallery] -> <p>[gallery]</p>    
[cardimg][/cardimg] -> <p>[cardimg][/cardimg]</p>
[W][/W] -> <p>[W][/W]</p>

I have tried every single solution here and on Google: https://wordpress.stackexchange.com/search?q=shortcode+wrap I don't know what to do at this point. Absolutely nothing I do changes the results.

1 Answer 1


Try https://wordpress.org/plugins/shortcode-empty-paragraph-fix/

It basically removes any p-tags before and after [ or ], before rendering the content.

So the output of your shortcodes won't be wrapped in p-tags


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.