有没有办法删除wptexturize
只针对某个短代码?
是否从短代码中删除wptexturize?
2 个回复
最合适的回答,由SO网友:Andy 整理而成
有一个线索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\' );
SO网友:Otto
短代码在wptexturize函数之后运行,因此它们无论如何都不应该被它处理。
wptexturize在优先级为10的\\u内容上运行。do\\u shortcode函数以优先级11运行。
结束