禁止WordPress 4.8版本自动将英文半角符号转换成全角符号

WordPress自动将英文半角符号转换成全角符号是因为WordPress的一个函数wptexturize()在作怪,既然如此,那就移除它。将下面的代码加入主题的模板函数funtions.php文件中,注意是加在最后一个 ?>之前:

//取消内容转义
remove_filter('the_content', 'wptexturize');
//取消摘要转义
remove_filter('the_excerpt', 'wptexturize');
//取消评论转义
remove_filter('comment_text', 'wptexturize');

至此,我已经完美解决了禁止WordPress自动将英文半角符号转换成全角符号这个问题了!

This entry was posted in Technology and tagged , , , , , . Bookmark the permalink. 79 views

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *