WordPress中会默认会自动转义一些字符,如将‘–’转义为‘-’破折号。WordPress作怪的函数就是wptexturize(),点这里查看WordPress官方说明。既然如此,那就移除它。将下面的代码加入主题的funtions.php文件的最后一个 ?> 中:
//取消内容转义
remove_filter('the_content', 'wptexturize');
//取消摘要转义
remove_filter('the_excerpt', 'wptexturize');
//取消评论转义
remove_filter('comment_text', 'wptexturize');
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END