【问题标题】:Wordpress: <script src="?ver=1.10.2"></script> being loaded out of nowhereWordpress:<script src="?ver=1.10.2"></script> 不知从何而来
【发布时间】:2013-09-18 06:41:35
【问题描述】:

网站:

http://ramprate.com/design1/

你会在&lt;head&gt;中找到一个脚本标签

<script type="text/javascript" src="http://ramprate.com/design1?ver=1.10.2"></script>

我不知道这是从哪里来的。我一次停用所有插件,每次停用后仍会加载标签。我从头文件中删除了wp_head(),但标签仍在&lt;body&gt;中加载

我花了很多时间试图弄清楚它在哪里排队,但无法确定。我发现这个 wordpress 安装上的 jQuery 版本是 1.10.2(WP 版本 3.6) - 所以我猜它与加载 jQuery 有关。在 wp-content 中对 1.10.2 的 grep 也不会产生任何结果。

你有什么想法吗?

【问题讨论】:

    标签: php wordpress


    【解决方案1】:

    我注意到“Better Wordpress Minify”中的一个错误可能会导致此问题。另请参阅此官方支持线程:http://wordpress.org/support/topic/wp-36-jquery-enqueued-but-wrong-script-written-after

    【讨论】:

    • 我应该自己回答这个问题。这是 BWP 插件的问题
    【解决方案2】:

    它很可能是通过插件加载的wp_enqueue_script,如果您愿意,可以使用 API 禁用它。不确定为什么你真的需要。

    <?php wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer ); ?>
    

    您会发现在脚本调用中$ver 被设置为true

    http://codex.wordpress.org/Function_Reference/wp_enqueue_script

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-08-24
      • 2011-02-26
      • 2015-06-07
      • 2018-07-22
      • 1970-01-01
      • 2021-01-27
      • 1970-01-01
      相关资源
      最近更新 更多