Disable automatic formatting inside WordPress shortcodes

后端 未结 4 672
面向向阳花
面向向阳花 2020-12-24 02:32

I\'ve seen the tutorials on creating a (raw) shortcode that leaves the code inside it untouched,

http://www.wprecipes.com/disable-wordpress-automatic-formatting-

4条回答
  •  醉话见心
    2020-12-24 03:20

    After implementing @helgatheviking's solution on multiple websites, I'm convinced that only these lines are required:

    // Move wpautop filter to AFTER shortcode is processed
    remove_filter('the_content', 'wpautop');
    add_filter('the_content', 'wpautop', 99);
    add_filter('the_content', 'shortcode_unautop', 100);
    

    Put them in your functions.php file and you're set.

提交回复
热议问题