更好的WordPress主题

怎么样可以禁止代码转义?

我在网上搜了很多方法全都无效,同样的下面这种方法我看网上他们用的最多的,但我用的时候完全无效。

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

修改 wp-includes/formatting.php 文件,把实现自动替换的相关语句注释掉。

// static strings 
//$curl = str_replace($static_characters, $static_replacements, $curl);
// regular expressions
//$curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl);

...
这个文件里我始终没有找到网上说的这段代码

求大神帮忙,到底怎么样才能设置代码不会转义??
头像以歌。先生 2016-08-11 提问 1817人浏览
分享
写回答

共以下 1 个回答:

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

加入到主题目录下的functions.php文件中
0赞同
1条评论
分享

写回答:

问题:怎么样可以禁止代码转义?

  • 插入代码
登陆后回答

建站!你有充足的理由选择我们

世界上超过43%的网站是由WordPress搭建,而我们是国内最靠谱的WordPress主题开发商
QQ客服 微信客服themebetter微信客服 在线工单 公众号themebetter微信公众号