该插件尚未通过WordPress的最新3个主要版本进行测试。 当与较新版本的WordPress一起使用时,可能不再受到维护或支持,并且可能会存在兼容性问题。

启用jQuery迁移助手

描述

随着WordPress 5.5的更新,默认情况下不再启用名为jquery-migrate的迁移工具。这可能会导致某些主题或运行较旧代码的插件无法发挥功能或出现异常。

此插件作为临时解决方案,使您站点的迁移脚本能够为插件和主题作者更多的时间来更新并测试其代码。

随着WordPress 5.6的更新,包含的jQuery版本也已升级。这意味着以前引起警告的旧代码现在可能会导致错误或完全停止工作。

一些不再起作用的功能将在幕后停止运作,且不会出现任何明显问题。

此插件将允许您暂时将jQuery版本降级;但作为网站管理员,您应该修复这些潜藏问题。

安装

  1. 将压缩包解压后上传至您网站的插件目录,这一目录通常为wp-content/plugins/
  2. 在“插件”页面,启用该插件。
  3. 大功告成!此插件将自动为您处理接下来的工作。

常见问题

当出现“有些函数已‘淘汰不用’”的提示,这意味着什么?

当一个脚本、一个文件或其他一些代码的开发者正在用更现代的代码将其替换或完全删除时,它将被弃用。

WordPress 5.6之后会发生什么

随着WordPress 5.6版本的发布,jQuery版本也得到了更新。但以前出现弃用警告的插件或主题现在将会出现错误。
如果出现此种情况,那么该插件可以让您暂时降级到jQuery的先前版本(该插件也会在第一次出现错误时自动为网站访问者自动尝试此操作),从而可以修复或替换代码。

如何找到及使用浏览器控制台?

请参阅WordPress.org上关于使用浏览器控制台日志分析JavaScript错误的文章。

该插件不会记录弃用或更改jQuery版本

如果您的站点有任何用于合并或优先加载JavaScript文件的插件,则该插件可能会受到负面影响,并且无法按预期运行。

如果您的站点需要依赖该插件来运作,请禁用所有与加载JavaScript文件有交互的插件,例如上述类型。解决根本问题后,您可以删除此插件并重新启用其他工具。

如何判断我的网站是否需要本插件?

如果您的网站在您升级WordPress后出现工作不正常等状况,您就可以尝试安装并启用本插件。若这个插件缓解了相关状况,则您需要保持插件的启用状态并遵从插件的指示。该插件将在您的网站不再需要该插件时提示您。

使用jQuery版本3时有很多弃用警告

鉴于jQuery版本3是最近才引入WordPress,这些警告在预期之中。

弃用的通知意味着迁移工具已安装到位,以确保在更新相关代码时,这些功能仍可继续使用。

评价

2024 年 1 月 4 日
The WooCommerce checkout error was solved and customers can now purchase successfully again. jQuery.Deferred exception: Cannot read properties of undefined (reading ‘defaults’) TypeError: Cannot read properties of undefined (reading ‘defaults’)
2023 年 11 月 18 日 1 回复
I really do think that you should still include or incorporate jquery migrate files in new versions or updates of wordpress. It’s crazy that you know this is gonna crash a bunch of sites (like thousands) yet you do it anyway. Oh, and while I’m here, please get rid of the block editor (or whatever the hell it is) in these comments! It’s not intuitive enough. Poor UX/UI. 😟☹️
2023 年 4 月 28 日 2 回复
Congratulations to whoever made this plugin. There were some editor display issues on wordpress and the plugin fixed them. Now clearly I have to go back to the problem to restore the correct functioning of wordpress. but wow! it was amazing!
2022 年 5 月 5 日
This is an excellent plugin! Works perfectly! I just wish there was an option to turn off the message that says this is not a permanent fix.
2022 年 2 月 18 日
Boy did this come in handy. Thanks for doing this. It got the menus working. This will give us time to replace the existing theme with our own. Thanks again! JL nwcic.com
2021 年 10 月 10 日
I was tired of seeing the jQuery red error, so I made a site backup and installed the plugin thinking I would need to do some sort of tweaking. However, I looked immediately after the install and no error whatsoever. I was pleasantly surprised. 5 Stars for sure. Thanks.
阅读所有109条评价

贡献者及开发者

“启用jQuery迁移助手” 是开源软件。 以下人员对此插件做出了贡献。

贡献者

「启用jQuery迁移助手」插件已被翻译至 16 种本地化语言。 感谢所有译者为本插件所做的贡献。

将“启用jQuery迁移助手”翻译成您的语言。

对开发感兴趣吗?

您可以浏览代码,查看SVN仓库,或通过RSS订阅开发日志

更新日志

v 1.4.0 (2023-07-31)

  • Fixed a bug where an empty error text would cause the plugin scripts from working properly.
  • Improved how inline scripts are detected and logged when applicable.
  • Improved logging to also capture deprecations within WordPress core.
  • Changed variable declarations for front-end scripts to use var instead of const and let, to improve compatibility for sites servicing older clients.
  • Updated the (modern) bundled jQuery Migrate script to match what is shipped with WordPress core.

v 1.3.0

  • Added legacy jQuery UI to be loaded if legacy jQuery is in use.
  • Added mention of site URLs in automatic emails.
  • Added option to enable/disable automatic downgrades.
  • Added logic to ensure only one downgrade request is sent per page load.
  • Updated logic around automatic downgrades for improved performance.
  • Fixed core deprecation notices being incorrectly labeled as undetermined inline ones.

v 1.2.0

  • 添加设置页面
  • 添加了降级到旧版jQuery的选项
  • 添加了自动降级
  • 添加了选项以记录现代jQuery中的弃用
  • 添加了电子邮件通知
  • Added weekly email digest of deprecations
  • Added option to allow logging deprecations from anonymous site visitors
  • Changed the handling of inline JavaScript code causing deprecation notices
  • Changed the admin bar to be two fixed links to avoid ever changing contexts
  • Changed the admin notices to be persistent when using legacy jQuery after upgrading to WordPress 5.6
  • Changed how concatenation is disabled, to address public-facing performance concerns
  • Fixed recommendation to remove plugin when not logging any deprecations having the wrong logic and not being displayed.

v 1.1.0

  • Added option to dismiss deprecation notices in backend
  • Added logging of deprecation notices in the front end
  • Added admin bar entry to show when deprecations occur
  • Added view of logged deprecations
  • Added dashboard notice encouraging users to remove the plugin if no deprecations have been logged in a while (1 week).
  • Changed the time interval between showing the dashboard nag from 2 weeks to 1 week, as WordPress 5.6 comes closer.

v 1.0.1

  • Fix one of the admin notices being non-dismissible.

v 1.0.0

  • 初始版本。