[英]jQuery.min.js not loading correctly after moving WordPress?
After moving my WordPress site to a new location, I started seeing weird behavior in the WP admin, including:将我的 WordPress 站点移动到新位置后,我开始在 WP 管理员中看到奇怪的行为,包括:
When checking the browser console after experiencing these things, I'm seeing a lot of "jQuery.Deferred exception: jQuery (someFunction) is not a function" and corresponding "Uncaught TypeError: jQuery (someFunction) is not a function" for several jQuery functions.在经历这些事情后检查浏览器控制台时,我看到很多“jQuery.Deferred exception: jQuery (someFunction) is not a function”和对应的“Uncaught TypeError: jQuery (someFunction) is not a function”几个jQuery(someFunction)不是一个函数功能。 For example:例如:
jquery.min.js?ver=3.5.1:2 jQuery.Deferred exception: jQuery(...).sortable is not a function TypeError: jQuery(...).sortable is not a function
at HTMLDocument.<anonymous> (<anonymous>:1:69)
at e (https://example.com/wp-includes/js/jquery/jquery.min.js?ver=3.5.1:2:30005)
at t (https://example.com/wp-includes/js/jquery/jquery.min.js?ver=3.5.1:2:30307) undefined
Uncaught TypeError: jQuery(...).sortable is not a function
at HTMLDocument.<anonymous> (<anonymous>:1:69)
at e (jquery.min.js?ver=3.5.1:2)
at t (jquery.min.js?ver=3.5.1:2)
The reading I've been doing on this makes it sound like the problem is that jQuery functions are being asked to run before they've been defined, and that the solution is to make sure jQuery gets loaded before anything dependant on it does.我一直在做的阅读使听起来问题是jQuery函数在定义之前被要求运行,解决方案是确保jQuery在任何依赖它的东西之前被加载。 That makes sense but when I check the source code, this is right near the top of the page:这是有道理的,但是当我检查源代码时,它就在页面顶部附近:
<script src='https://example.com/wp-includes/js/jquery/jquery.min.js?ver=3.5.1' id='jquery-core-js' type="text/psajs" orig_index="2"></script>
I haven't done anything with wp_enqueue_script () because everything I've read so far makes it seem like that only comes into play if I'm adding some custom js...but the only "custom" javascript on my site is whatever's included with the plugins I've got.我没有对 wp_enqueue_script () 做任何事情,因为到目前为止我所阅读的所有内容似乎只有在我添加一些自定义 js 时才会发挥作用......但是我网站上唯一的“自定义”javascript 是什么包含在我拥有的插件中。 And again, none of this was happening before I moved WordPress.同样,在我移动 WordPress 之前,这一切都没有发生。
What I'm trying to understand specifically is:我想具体了解的是:
Thanks in advance for anyone able and willing to provide assistance!提前感谢任何能够并愿意提供帮助的人!
Turning off a module on my web server called mod_pagespeed_beacon fixed all three of these issues.在我的 web 服务器上关闭一个名为 mod_pagespeed_beacon 的模块解决了所有这三个问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.