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 是非常新的版本,因此這些都是可預期的狀況。

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

使用者評論

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

參與者及開發者

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

參與者

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

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

對開發相關資訊感興趣?

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

  • 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.