启用jQuery迁移助手

描述

With the update to WordPress 5.5, a migration tool known as jquery-migrate was no longer enabled by default. This may lead to lacking functionality or unexpected behavior in some themes or plugins that run older code.

This plugin serves as a temporary solution, enabling the migration script for your site to give your plugin and theme authors some more time to update, and test, their code.

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

Some of the features no longer working will just stop working behind the scenes without any apparent problem.

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

安装

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

常见问题

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

A script, a file, or some other piece of code is deprecated when its developers are in the process of replacing it with more modern code or removing it entirely.

WordPress 5.6之后会发生什么

With the release of WordPress 5.6, the jQuery version also gets updated. This means that plugins or themes that previously caused deprecation warnings now instead will cause errors.
This plugin will allow you to, temporarily, return to the previous version of jQuery if this happens (it will also try to do so automatically for website visitors the first time an error happens) allowing you to fix the code, or replace it.

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

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

The plugin isn’t logging deprecations or changing jQuery versions

If your site has any plugins for combining JavaScript files, or loading them asynchronously, this plugin may be negatively affected and not be able to operate as intended.

If your site requires this plugin to operate, please disable any plugins which interact with the loading of JavaScript files such as the types mentioned above. Once the underlying issue has been resolved, you may remove this plugin and re-enable those other tools.

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

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

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

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

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

评价

2021年2月26日
I was referred to this plugin from Qode Interactive (who I purchased my theme from) in order to fix some issues on my website, but then once I installed the plugin it completely broke my website. I tried to disable and uninstall it, but the affects of the plugin stayed. I tried to restore from a backup, but even that didn't work!! Finally, I contacted SiteGround and an agent helped me identify that the plugin left some file in the public_html folder that was outside of the backup. He deleted the files from public_html, restored from backup and I purged my cache and everything is working again. Lot of trouble to get back to square 1.
2021年2月26日
Every time WordPress is updated this plugin is reinstalled, every time it's reinstalled I get an email telling me I don't need this plugin and that I should think about deleting it, and every time I delete the plugin it's reinstalled when WordPress gets updated. I can't get this plugin to stop being installed without my consent
2021年1月27日
Excellent catch for this update. Thanks to your quick work, I kept my site looking good while I can continue to upgrade things out of the public eye for now.
2021年1月29日
Enabled it fixes all the jquery issues from the update BUT Backend forms are broken. JQMIGRATE: Migrate is installed with logging active, version 1.4.1 jquery-1.12.4-wp.js?ver=1.12.4-wp:2 Uncaught Error: Syntax error, unrecognized expression: https://film.ca/wp-admin/admin.php?page=wc-settings&tab=products at Function.ea.error (jquery-1.12.4-wp.js?ver=1.12.4-wp:2) at ea.tokenize (jquery-1.12.4-wp.js?ver=1.12.4-wp:2) at ea.select (jquery-1.12.4-wp.js?ver=1.12.4-wp:2) at Function.ea (jquery-1.12.4-wp.js?ver=1.12.4-wp:2) at Function.jQuery.find (jquery-migrate-1.4.1-wp.js?ver=1.4.1-wp:301) at n.fn.init.find (jquery-1.12.4-wp.js?ver=1.12.4-wp:2) at n.fn.init.jQuery.fn.find (jquery-migrate-1.4.1-wp.js?ver=1.4.1-wp:688) at jQuery.fn.init.n.fn.init (jquery-1.12.4-wp.js?ver=1.12.4-wp:2) at new jQuery.fn.init (jquery-migrate-1.4.1-wp.js?ver=1.4.1-wp:252) at n (jquery-1.12.4-wp.js?ver=1.12.4-wp:2) wp-auth-check.min.js?ver=5.6:2 Uncaught TypeError: Cannot read property 'hasClass' of undefined at HTMLDocument.<anonymous> (wp-auth-check.min.js?ver=5.6:2) at HTMLDocument.dispatch (jquery-1.12.4-wp.js?ver=1.12.4-wp:3) at HTMLDocument.r.handle (jquery-1.12.4-wp.js?ver=1.12.4-wp:3) at Object.trigger (jquery-1.12.4-wp.js?ver=1.12.4-wp:3) at Object.jQuery.event.trigger (jquery-migrate-1.4.1-wp.js?ver=1.4.1-wp:644) at HTMLDocument.<anonymous> (jquery-1.12.4-wp.js?ver=1.12.4-wp:3) at Function.each (jquery-1.12.4-wp.js?ver=1.12.4-wp:2) at jQuery.fn.init.each (jquery-1.12.4-wp.js?ver=1.12.4-wp:2) at jQuery.fn.init.trigger (jquery-1.12.4-wp.js?ver=1.12.4-wp:3) at Object.<anonymous> (heartbeat.min.js?ver=5.6:2) When I disable the jquery migrate plugin the woocommerce backend functions properly again. jquery.min.js?ver=3.5.1:2 Uncaught Error: Syntax error, unrecognized expression: https://film.ca/wp-admin/admin.php?page=wc-settings&tab=products at Function.se.error (jquery.min.js?ver=3.5.1:2) at se.tokenize (jquery.min.js?ver=3.5.1:2) at se.select (jquery.min.js?ver=3.5.1:2) at Function.se (jquery.min.js?ver=3.5.1:2) at Function.s.find (jquery-migrate.min.js?ver=3.3.2:2) at S.fn.init.find (jquery.min.js?ver=3.5.1:2) at s.fn.init.S.fn.init (jquery.min.js?ver=3.5.1:2) at new s.fn.init (jquery-migrate.min.js?ver=3.3.2:2) at S (jquery.min.js?ver=3.5.1:2) at HTMLDocument.<anonymous> (options-custom.js?ver=5.6:19) se.error @ jquery.min.js?ver=3.5.1:2 se.tokenize @ jquery.min.js?ver=3.5.1:2 se.select @ jquery.min.js?ver=3.5.1:2 se @ jquery.min.js?ver=3.5.1:2 s.find @ jquery-migrate.min.js?ver=3.3.2:2 find @ jquery.min.js?ver=3.5.1:2 S.fn.init @ jquery.min.js?ver=3.5.1:2 s.fn.init @ jquery-migrate.min.js?ver=3.3.2:2 S @ jquery.min.js?ver=3.5.1:2 (anonymous) @ options-custom.js?ver=5.6:19 e @ jquery.min.js?ver=3.5.1:2 t @ jquery.min.js?ver=3.5.1:2 setTimeout (async) S.readyException @ jquery.min.js?ver=3.5.1:2 (anonymous) @ jquery.min.js?ver=3.5.1:2 e @ jquery.min.js?ver=3.5.1:2 t @ jquery.min.js?ver=3.5.1:2 setTimeout (async) (anonymous) @ jquery.min.js?ver=3.5.1:2 c @ jquery.min.js?ver=3.5.1:2 fireWith @ jquery.min.js?ver=3.5.1:2 fire @ jquery.min.js?ver=3.5.1:2 c @ jquery.min.js?ver=3.5.1:2 fireWith @ jquery.min.js?ver=3.5.1:2 t @ jquery.min.js?ver=3.5.1:2 setTimeout (async) (anonymous) @ jquery.min.js?ver=3.5.1:2 c @ jquery.min.js?ver=3.5.1:2 fireWith @ jquery.min.js?ver=3.5.1:2 fire @ jquery.min.js?ver=3.5.1:2 c @ jquery.min.js?ver=3.5.1:2 fireWith @ jquery.min.js?ver=3.5.1:2 ready @ jquery.min.js?ver=3.5.1:2 B @ jquery.min.js?ver=3.5.1:2 3?v=2.0:6 WebSocket connection to 'wss://public-api.wordpress.com/pinghub/wpcom/me/newest-note-data' failed: Error during WebSocket handshake: Unexpected response code: 403
阅读所有的99评价

贡献者及开发者

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

贡献者

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

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

对开发感兴趣吗?

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

更新日志

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

  • 初始版本。