• How to survive WordPress 5.5’s removal of jQuery-migrate

    How to survive WordPress 5.5’s removal of jQuery-migrate

    I started upgrading to WordPress 5.5 and soon began to experience a load of problems with core functionality. Things that should work no longer worked. I first noticed it on a client’s site when Media Library didn’t display anything.

    Media Library not working in WordPress 5.5.

    WordPress TRAC Issue #50993

    This post summarises my investigations, some of the problems I encountered, the workaround and some notes about what I need to do in the future, which is a work in progress.

    TL;DR – 25th August 2020

    As far as team Yoast are concerned the problem should go away if I upgrade to WordPress SEO v14.8.1.

    Fixes a bug in WordPress itself where script concatenation was causing JavaScript errors, which in turn led to Yoast SEO malfunctioning. This bug was introduced in WordPress 5.5. We’re fixing it by disabling script concatenation entirely.

    from the WordPres SEO v14.8.1 readme.txt file

    With their fix being a workaround. Roll on WordPress 5.5.1

    TL;DR – previous update

    The problems that I documented last week were either due to a bug in WordPress or a bug in the Gutenberg plugin. There were two TRAC issues, and the problem had already been reported in Yoast’s GitHub repo.

    The problem originally occurred with Gutenberg 8.7.1, WordPress SEO 14.7 and WordPress 5.5.

    It appears that Gutenberg 8.8.0 has fixed the problem. There’s no longer a need to apply the patch developed for TRAC ticket #50999, nor, it seems, do I need the Enable jQuery Migrate Helper plugin.

    The “what I need to do in the future” part is still a work in progress”. I’ve created a GitHub Project for it.

    Media Library not working in WordPress 5.5

    In my attempts to determine what was causing the error I deactivated Gutenberg, which was the latest version 8.7.1. And the problem went away.

    So I wrote to the WordPress Slack #core-editor channel asking,

    Am I the only one having problems with Gutenberg 8.7.1 and WordPress 5.5 – media library not working.

    Herb Miller – 14th August 2020

    And I was told

    Workaround: Install Enable jQuery Migrate Helper

    Nope, you’re not. It’s related to jquery-migrate changes. Installing this plugin for now resolves until other plugins migrate from needing jquery migrate.

    Derek Sifford

    I thanked Derek and got the plugin.

    Futher Problem Analysis

    But I wasn’t happy. The plugin hides the issues uncovered by the WordPress 5.5. update. As it says in the readme.txt file

    With the update to WordPress 5.5, a migration tool known as jquery-migrate will no longer be enabled by default. 

    This may lead to unexpected behaviors in some themes or plugins who 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.

    extract from Enable jQuery Migrate Helper readme.txt file

    So what are these unexpected behaviours? And how am I supposed to find which plugins/themes are the cause of the problem?

    Some unexpected behaviours when jquery-migrate is missing

    I performed some experiments and found a number of other problems which occurred when the only two activated plugins were Gutenberg 8.7.1 and WordPress SEO 14.7.

    Appearance Themes not working in WordPress 5.5

    With this combination, Media Library now worked, but I couldn’t use Appearance Themes; Add New didn’t work, nor did the Theme Details button.

    I’d first noted the problem with the PhotoFocus theme (on the client’s site), but discovered these additional problems with Twenty Nineteen ( on my test site ). Updating Twenty Nineteen to v1.7 didn’t resolve the issue.

    Appearance > Themes > Add new not working in WordPress 5.5

    Opening the Inspector reveals the JavaScript error.

    Appearance > Themes > Theme Details not working in WordPress 5.5

    Opening the Inspector reveals the JavaScript error.

    Deactivating either Gutenberg or WordPress SEO appears to resolve these issues. But it’s not a workable solution in the long term; you need the helper plugin.

    Finding which plugins / themes cause the problem

    There’s another official plugin called Test jQuery Updates which was developed for plugin and theme developers. It’s only been downloaded 3000 times, which suggests either it’s not useful or not enough developers were told about it before 5.5 was released. I was aware of it but hadn’t gotten around to testing any of my code.

    This plugin is supposed to help.

    First I’m going to have to make sure that the theme I’m using isn’t the culprit. This’ll help me confirm that Gutenberg and WordPress SEO are safe to use.

    Results with Test jQuery Updates

    I didn’t really know what to expect but it certainly wasn’t the results I got.

    When I activated the Test jQuery Updates plugin the problems in Appearance > Themes went away.

    What does that mean?

    Even more analysis

    Having written up these findings and publishing a link on the #core-editor channel on Making WordPress Slack I then discovered WordPress TRAC ticket #50993. The problem was identical to the one I’d seen at the start. I wrote to the channel again. Taco Verdonschot suggested I look at TRAC ticket #50999.

    So I reproduced the Appearance > Themes problems locally, applied the fix and the problems were resolved.

    Being unable to reproduce the initial Media library problem anywhere but the original site I applied the fix there as well. It worked there too.

    So now I had to find out how to reproduce the original problem in a different environment. After a cycle ride in the rain I discovered the answer. The original problem occurs when you’re viewing the Media library in Grid mode. Change it to List and it seems OK.

    I’ve updated the TRAC tickets and GitHub issues. Hopefully the fix for #50999 will be in WordPress 5.5.1. And then I’ll be able to continue looking at my own plugins.

    How do you fix the code?

    If it’s your own plugin / theme that needs updating then you can find help by searching for something like “how to update to avoid using jquery-migrate”.

    What about my oik plugins?

    This is the process I’m going to follow.

    1. Identify plugins that make some use of jQuery.
    2. Test each of them with WordPress 5.5 (incl. WordPress Multi Site).
    3. If they work then fine.
    4. If not, then raise issues and fix them.
    5. Update Tested with: 5.5 for every plugin that works.

    Update 25th August. Having created a GitHub project I’m now halfway through Step 2. I created a GitHub project: Peaceful coexistance with WordPress 5.5’s jQuery Migrate removal.

    Plugins that you may need

    Plugin name and description Plugin links Version, total downloads, last update, tested
    Enable jQuery Migrate Helper
    Get information about calls to deprecated jQuery features in plugins or themes.
    1.4.0
    1,846,597
    July 31, 2023
    6.3.2
    Test jQuery Updates
    Test different versions of jQuery and jQuery UI.
    2.0.0
    71,126
    December 9, 2020
    5.6.12

    Further reading

    TRAC’s and Issues


    ,

    Published:

    Last updated:

    August 25, 2020

Categories

Tide times from tidetimes.org.uk

Tide Times & Heights for Langstone Harbour on
4th December 2023
03:48 High Tide ( 4.09m )
08:48 Low Tide ( 2.03m )
15:46 High Tide ( 3.84m )
21:15 Low Tide ( 1.91m )

Tide times from tidetimes.org.uk

Tide Times & Heights for Northney on
4th December 2023
04:09 High Tide ( 3.96m )
09:06 Low Tide ( 1.86m )
16:13 High Tide ( 3.74m )
21:39 Low Tide ( 1.7m )