Disable automatic formatting inside WordPress shortcodes

后端 未结 4 676
面向向阳花
面向向阳花 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:16

    In my case - this solution has broken one of the side shortcodes (revslider).

    So I've found another solution here: http://wordpress-hackers.1065353.n5.nabble.com/shortcode-unautop-tp42085p42086.html

    Which is to use another filter like this:

    // Via http://www.wpexplorer.com/clean-up-wordpress-shortcode-formatting/
    if ( !function_exists('wpex_fix_shortcodes') ) {
        function wpex_fix_shortcodes($content){
            $array = array (
                '

    [' => '[', ']

    ' => ']', ']
    ' => ']' ); $content = strtr($content, $array); return $content; } add_filter('the_content', 'wpex_fix_shortcodes'); }

    It works fine for me :)

提交回复
热议问题