Удалить wptexturize из шорткода?


Есть ли способ удалить wptexturize только для определенного шорткода?

Author: Jared, 2011-03-22

2 answers

В функции wp-includes/formatting.php есть подсказка wptexturize:

$default_no_texturize_shortcodes = array('code');
...
$no_texturize_shortcodes = '(' . implode('|',
    apply_filters('no_texturize_shortcodes', $default_no_texturize_shortcodes) ) . ')';

Попробуйте использовать этот фильтр, чтобы добавить шорткод в массив:

function my_no_tex( $shortcodes ) {
    $shortcodes[] = 'someshortcode';
    return $shortcodes;
}
add_filter( 'no_texturize_shortcodes', 'my_no_tex' );
 5
Author: Andy, 2011-03-30 15:52:23

Короткие коды запускаются после функции wptexturize, поэтому они все равно не должны обрабатываться ею.

Wptexturize выполняется на the_content с приоритетом 10. Функция do_shortcode выполняется с приоритетом 11.

 3
Author: Otto, 2011-03-30 02:31:01