【发布时间】:2015-02-16 07:16:19
【问题描述】:
我正在为 Wordpress 使用 Google 跟踪代码管理器插件,而 WP 不断将 CDATA 添加到跟踪代码管理器脚本中,但 site 验证失败。在没有 CDATA 的情况下,我的其他简单 html 网站都得到了验证。
根据我找到的答案here,我将 wp-includes\post-template.php 第 167 行更改为此
$content = str_replace('<![CDATA[','',$content);
$content = str_replace(']]>','',$content);
//$content = str_replace(']]>', ']]>', $content);
但是,WP 仍在将 CDATA 添加到脚本中。
如何防止这种情况发生?还有其他方法吗?
【问题讨论】:
标签: php wordpress cdata google-tag-manager