WordPress 如何/在我的文件头中包含 jquery?
WordPress 以某种方式将 jquery 包含在我网站的标题中。我已经手动安装了 jquery,并且希望关闭额外的包含。
它似乎不是来自任何插件。有谁知道它可能来自哪里?
Wordpress is somehow including jquery in the header of my site. I already have jquery manually installed, and would prefer to turn off the extra inclusion.
It doesn't seem to be coming from any plugins. Does anyone have any ideas where it may be coming from?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当使用 wp_enqueue_script 调用依赖于它的其他脚本时,它会自动调用。
不要将其内嵌在标头中,而是将其添加到您的functions.php中
It's automatically called when other scripts dependent on it are called using wp_enqueue_script.
Instead of putting it inline in your header add this to your functions.php
这很可能是通过一个钩子完成的,该钩子使用
add_action
API 函数。检查主题中的functions.php 文件,看看其中是否有任何内容正在执行此操作。有关挂钩的更多详细信息,请参阅 http://codex.wordpress.org/Plugin_API#Hook_to_WordPress。
另外,如果您知道添加的操作的名称,您可以通过在主题的functions.php文件中放置如下代码来删除它:
在示例代码中,这将删除注册的操作调用
wlwmanifest_link
被附加到操作循环的wp_head
部分。您正在寻找的包含 jquery 的add_action
语句很可能会附加到wp_head
,因为这就是您在循环期间插入代码的方式。Chances are, this is being done with a hook, which uses the
add_action
API function. Check the functions.php file in your theme and see if there's anything in there that's doing it.See http://codex.wordpress.org/Plugin_API#Hook_to_WordPress for more details on hooks.
Also, if you know what the added action is named, you can remove it by placing code like this in the functions.php file in your theme:
In the example code, this will remove a registered action call
wlwmanifest_link
that was tacked onto thewp_head
section of the action loop. Chances are, theadd_action
statement you're looking for that is including jquery will be attached towp_head
since that's how you get code inserted there during the loop.