Wordpress替换字符输出破坏我的脚本


Wordpress replace character output that breaks my script

我正在使用wordpress 4.2.2,我发现了一个非常奇怪的问题。在一个插件上,我发现插件作者打印了这样的输出:

        echo '  if (responsiveEntries!=undefined && responsiveEntries.length>0)'."'n";
        echo '      jQuery.each(responsiveEntries, function(index,obj) {'."'n";
        echo '          var curw = obj.width != undefined ? obj.width : 0,'."'n";
        echo '              cura = obj.amount != undefined ? obj.amount : 0;'."'n";
......etc

问题出现在前端,当我调试时,输出变成这样:

    if (responsiveEntries!=undefined && responsiveEntries.length>0)
         jQuery.each(responsiveEntries, function(index,obj) {
            var curw = obj.width != undefined ? obj.width : 0,
            cura = obj.amount != undefined ? obj.amount : 0;

如你所见…字符&&被安全字符(&# 038;) . .它打破了剧本……我想知道如何调试这个问题,我已经关闭了不必要的插件,问题就在那里。所以我相信它与主题或核心wordpress有关

问题只发生在帖子或自定义帖子类型。当我把短代码放在页面上…没有问题

有什么想法吗?

似乎在wordpress中有一个默认的过滤器叫做wp_texturizer()和convert_char()谁转换&成&

为了解决这个问题,我使用

remove_filter ('the_content','wp_texturize'); apply_filter('the_content',$my_content); add_filter ('the_content','wp_texturize');