I need to disable wpautop for some shortcodes. I've read the following on how to disable it:

However these apply to wpautop in general.

I want to only disable it for specific shortcodes, because some shortcodes in my theme rely on that wpautop in order to work.

1 Answer 1


Well, there is a script out there. The author claims that it removes the wpautop form individual specific shorcodes. You'll find it here.

Add this to your functions.php or your plugin like below-

// Here I assumed that you kept the name of the PHP script file same 
include "shortcode-wpautop-control.php";

And then call the function ike below-


You can also call it like this-

// Create first the array of shortcodes from which you wanna remove `wpautop`
$array_of_shortcodes = [ 
// Then pass the array as parameter when you're calling the function
chiedolabs_shortcode_wpautop_control( $array_of_shortcodes );

Please note that, this solution isn't tested. Test it before going to production.

  • I've tested and it has an issue with Ad Injection plugin
    – Revious
    Commented Nov 6, 2019 at 17:07

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.