Enable jQuery Migrate Helper

外掛說明

WordPress 更新至 5.5 版後,便不再預設啟用移轉工具 jquery-migrate,這會造成某些執行舊版程式碼的佈景主題及外掛缺少功能或產生未預期的行為。

這個外掛提供一個暫時性的因應措施,它能為 WordPress 5.5 的網站啟用移轉指令碼,以便讓 (網站已採用的) 外掛及佈景主題開發者,能夠有更多時間完成程式碼更新及測試。

隨著 WordPress 5.6 的更新,內建的 jQuery 版本也一併升級。這代表以前觸發警告的舊版程式碼,現在會造成網站執行錯誤或全面停擺。

某些不再能正常執行的功能會在背景停止運作,而不會產生任何明顯的問題。

這個外掛能讓網站降級至舊版 jQuery 一段時間,但網站管理員仍應積極修復基礎問題。

安裝方式

  1. 將壓縮檔解壓縮後所得的 enable-jquery-migrate-helper 資料夾及其檔案上傳至 wp-content/plugins/ 資料夾。
  2. 請於 [外掛] 頁面啟用這個外掛。
  3. 大功告成!這個外掛會自動為網站處理接下來的工作。

常見問題集

『有些項目「已淘汰不用」』代表什麼?

當開發者使用更符合開發規範的指令碼、檔案或其他程式碼片段取代現有版本時,舊有項目便會遭到移除及棄用。

WordPress 5.6 發佈後的變更

隨著 WordPress 5.6 的發佈,內建的 jQuery 也一併完成了更新;這代表之前會出現「淘汰不用項目警告訊息」的外掛或佈景主題,現在會造成網站發生錯誤。這個外掛能讓網站在發生這類錯誤時,暫時性的改用舊版 jQuery 以修正程式碼或更換為其他程式,並且會在網站訪客讓網站產生第一次錯誤時就自動採取這項暫時性措施。

如何找到及使用瀏覽器主控台?

請參閱 WordPress.org 上的〈使用瀏覽器診斷 JavaScript 錯誤〉線上說明。

這個外掛不會記錄已遭淘汰不用的項目或變更 jQuery 版本

如果網站使用任何會合併 JavaScript 檔案,或以非同步方式載入 JavaScript 檔案,則這類外掛便會受到負面影響,導致無法如預期般執行。

如果網站需要這個外掛才能運作,請停用會以上述方式載入 JavaScript 檔案進行互動的外掛。當基礎問題解決後,網站管理員變可以移除這個外掛並重新啟用其他工具。

如何判斷網站是否需要這個外掛

如果 WordPress 網站升級後發生異常狀況,網站管理員便可以為網站安裝並啟用這個外掛。如果安裝啟用這個外掛後異常狀況有了緩解,請保持這個外掛的啟用狀態,並遵循外掛顯示的相關說明。當網站不再需要這個外掛時,外掛會顯示相關提示。

使用 jQuery v3 時,出現很多「淘汰不用項目警告訊息」

對 WordPress 來說,jQuery v3 是非常新的版本,因此這些都是可預期的狀況。

「淘汰不用項目通知」代表移轉工具已準備就緒,它能確保相關程式碼在第三方開發者進行更新、修改的期間,相關功能仍能正常執行。

使用者評論

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 則使用者評論

參與者及開發者

以下人員參與了開源軟體〈Enable jQuery Migrate Helper〉的開發相關工作。

參與者

Enable jQuery Migrate Helper 外掛目前已有 16 個本地化語言版本。 感謝全部譯者為這個外掛做出的貢獻。

將 Enable jQuery Migrate Helper 外掛本地化為台灣繁體中文版

對開發相關資訊感興趣?

任何人均可瀏覽程式碼、查看 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

  • Added settings page
  • Added option for downgrading to legacy jQuery
  • Added automatic downgrades
  • Added option to log deprecations in modern jQuery
  • Added e-mail notifications
  • 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

  • Initial release.