Make WordPress Core

Opened 3 years ago

Last modified 5 hours ago

#60478 assigned task (blessed)

Upgrade to jQuery 4.0

Reported by: nickchomey Owned by: Clorith
Priority: normal Milestone: Future Release
Component: External Libraries Version:
Severity: normal Keywords: needs-testing early has-patch
Cc: Focuses: javascript

Description (last modified by TobiasBg)

Version 4.0.0 of jQuery has been released.
​https://blog.jquery.com/2026/01/17/jquery-4-0-0/

Previously:
~JQuery just released a beta version of jQuery v4. Is this something that wp core will be looking to implement?~
​https://blog.jquery.com/2024/02/06/jquery-4-0-0-beta/

Change History (58)

This ticket was mentioned in ​Slack in #core by swissspidy. ​View the logs.


3 years ago

#2 @mgol
3 years ago

#60511 was marked as a duplicate.

#3 @swissspidy
3 years ago

  • Severity critical → normal

#4 follow-up: @swissspidy
3 years ago

@azaozz Maybe something for the ​https://wordpress.org/plugins/wp-jquery-update-test/ plugin?

#5 in reply to: ↑ 4 @azaozz
3 years ago

  • Milestone Awaiting Review → Future Release

Is this something that wp core will be looking to implement?

Of course :)

Replying to swissspidy:

Maybe something for the ​https://wordpress.org/plugins/wp-jquery-update-test/ plugin?

Yep, thinking the test plugin can be updated for WP 6.5 (currently in beta). Then try to time the update to jQuery 4.0 depending on when it is released.

Last edited 3 years ago by azaozz (previous) (diff)

#6 @firoz2456
3 years ago

The ​https://wordpress.org/plugins/wp-jquery-update-test/ plugin is not compatible with newer versions of WordPress; it is only compatible with WordPress 5.6 and earlier versions.
Does anyone have suggestions on how to test it with jQuery 4.0.0 BETA?

This ticket was mentioned in ​PR #6304 on ​WordPress/wordpress-develop by ​@adamsilverstein.


3 years ago
#7

  • Keywords has-patch has-unit-tests added

Trac ticket:

​@adamsilverstein commented on ​PR #6304:


3 years ago
#8

All tests pass here despite having removed utf8_encode, which is unexpected. is it possible this encoding is no longer required?

#9 @adamsilverstein
3 years ago

  • Focuses performance added

#10 @adamsilverstein
3 years ago

Adding the performance tag, noting that the new jQuery version touts some performance benefits, including a "slim" version with a smaller size. ​https://blog.jquery.com/2024/02/06/jquery-4-0-0-beta/

This ticket was mentioned in ​Slack in #core-performance by mukeshpanchal27. ​View the logs.


2 years ago

#12 @mukesh27
2 years ago

  • Keywords needs-patch added; has-patch has-unit-tests removed

#13 @adamsilverstein
2 years ago

Note the linked PR above is not related to this ticket, I'm not sure how it got linked and can't seem to remove the linkage.

This ticket was mentioned in ​Slack in #core-performance by mukeshpanchal27. ​View the logs.


2 years ago

#15 follow-up: @adamsilverstein
2 years ago

@azaozz Maybe something for the ​https://wordpress.org/plugins/wp-jquery-update-test/ plugin?

I opened ​this issue to track adding support in the wp-jquery-update-test plugin.

Last edited 2 years ago by adamsilverstein (previous) (diff)

#16 in reply to: ↑ 15 @azaozz
2 years ago

Replying to adamsilverstein:

Thanks. Yea, lets update the plugin for WP 6.5+. Seems it will only need to replace the bundled version of jQuery.

Somewhat unsure if jQuery 4.0 beta supports Migrate 3.4.1 and UI 1.13.2, or these will have to be updated too (when updates are available). Still good to update the test plugin imho.

Last edited 2 years ago by azaozz (previous) (diff)

#17 @azaozz
2 years ago

@adamsilverstein Updated the test plugin: ​https://github.com/WordPress/wp-jquery-update-test, could you have a look too if you get a chance :)

Also did some quick testing with jQuery 4.0.0-beta in wp-admin and everything seems to be working well. If all seems okay with the test plugin the next step would be to publish on make/core and invite (a lot) more testing.

#18 @azaozz
2 years ago

Been seeing this bug in jQuery Migrate ​https://github.com/jquery/jquery-migrate/issues/495 quite a bit recently jQuery.expr.match.bool is undefined. It is patched upstream but there's no new Migrate release yet. As WP depends on running jQuery Migrate, thinking to release the test plugin with a new version of Migrate so the people that will test jQuery 4 in WP don't run into it.

#19 follow-up: @mgol
2 years ago

@azaozz thanks for the reminder. I’m on vacation now but I’ll remember to release a new Migrate on early July when I’m back.

#20 in reply to: ↑ 19 @azaozz
2 years ago

Replying to mgol:

Great, thank you!

#21 follow-up: @mgol
2 years ago

@azaozz jQuery Migrate 3.5.0 has been released: ​https://github.com/jquery/jquery-migrate/releases/tag/3.5.0

#22 in reply to: ↑ 21 @azaozz
2 years ago

Replying to mgol:

Thanks for the ping! Will update the WP test plugin asap.

#23 @azaozz
2 years ago

Updated the ​test plugin.

@adamsilverstein Could you have a quick look if I haven't missed anything. Thinking to release it as soon as WP 6.6 is out.

Last edited 2 years ago by azaozz (previous) (diff)

#24 @adamsilverstein
2 years ago

Updated the test plugin.

Excellent, thank you @azaozz! I'll take a look.

#25 follow-up: @adamsilverstein
2 years ago

All of the readme and base class updates look good, I'm happy to try some testing, but I think its fine to release and get wider testing at this point so we can see how smooth upgrading goes for people.

#26 in reply to: ↑ 25 @azaozz
2 years ago

Replying to adamsilverstein:

Great! Thanks for having a look. Will release it in couple of days, as soon as WP 6.6 is out.

#27 @azaozz
2 years ago

Testing plugin released: ​https://wordpress.org/plugins/wp-jquery-update-test/. Please install it and test!

#28 @swissspidy
2 years ago

The second beta of jQuery 4.0.0 has been released: ​https://blog.jquery.com/2024/07/17/second-beta-of-jquery-4-0-0/

Note the changed handling of boolean attributes, that’s the most risky change in this release compared to the previous beta.

#29 @azaozz
2 years ago

The second beta of jQuery 4.0.0 has been released:

Yep, updated the testing plugin to include it and the latest jQuery Migrate. Also posted to make/core: ​https://make.wordpress.org/core/2024/08/23/updating-jquery-shipped-with-wordpress-to-version-4-0/

This ticket was mentioned in ​Slack in #core by desrosj. ​View the logs.


10 months ago

#31 @mgol
10 months ago

A while ago, we've released 4.0.0-rc.1: ​https://blog.jquery.com/2025/08/11/jquery-4-0-0-release-candidate-1/.

We haven't got any serious bug reports since that release, so we're preparing to release the final version, likely with few changes from the RC. That said, ticket #51812 needs to be addressed - removing jQuery Migrate 3.x - before the update to jQuery 4.x can be attempted.

#32 @mgol
10 months ago

See also a related ticket #62757 about updating jQuery UI to 1.14 - that release line is already 1.5 years old and has few breaking changes (mostly dropping IE & Edge Legacy support).

#34 follow-ups: @TobiasBg
9 months ago

  • Keywords needs-testing added
  • Milestone Future Release → 7.0

I tentatively moved this to milestone 7.0. Given that we are still in the alpha phase, it might good to implement this soon, to get lots of testing.

Main changes are removed support with older versions of IE, but that should not be critical as WordPress did that itself recently.
However, several already deprecated API methods (e.g. those that now have native JS alternatives) have been removed, which could have an impact on plugins that are (still) using them (despite long-existing deprecation warnings).

Given that this breaks backward compatibility, it might be worth considering updating jQuery-migrate to 3.6.0 first (see #51812), if the direct update to jQuery 4.0 turns out to have too many immediate downsides.

An upgrade guide is available at ​https://jquery.com/upgrade-guide/4.0/

#35 @TobiasBg
9 months ago

  • Description modified (diff)
  • Summary Upgrade to JQuery 4 → Upgrade to jQuery 4.0
  • Type enhancement → task (blessed)

For updating the jQuery version in WordPress, package.json and script-loader.php need to get the new version string.

Related: #59227, #58083, #58203, #57324, #56451, #52707, #51812, #50564, #37110.

#36 in reply to: ↑ 34 @nickchomey
9 months ago

Replying to TobiasBg:

However, several already deprecated API methods (e.g. those that now have native JS alternatives) have been removed, which could have an impact on plugins that are (still) using them (despite long-existing deprecation warnings).

I use a variety of plugins where jQuery-migrate already logs deprecation warnings. I assume these will break entirely when Core moves to 4.0.

However, one worry I have with relying mainly on wp-jquery-update-test + jQuery Migrate is that it only tells you what breaks while you’re clicking around. Any JS that doesn’t run during testing just gets missed.

Would it make sense to add a static scan that looks at a plugin/theme’s JS files and flags removed or deprecated jQuery APIs with file + line number, without executing the code? This seems a lot like what Plugin Check already does for PHP, but for jQuery compatibility.

As a secondary thing (clearly non-blocking), the same scan could eventually point out places where jQuery usage could be optionally "modernized" to use vanilla js and browser APIs. This could be part of the broader Performance team efforts.

Whatever the approach, I suspect this will cause more issues than a typical core update. So, I think this would need a solid pre-emptive outreach effort such that plugin devs even become aware of the changes and possible solutions ahead of time.

This ticket probably isn’t the right place for that discussion, but where would it make sense to continue it? Plugin Check repo? Core Slack?

Last edited 9 months ago by nickchomey (previous) (diff)

#37 @nickchomey
9 months ago

As it turns out, there was considerable discussion on all of these points (outreach, compatibility detection, modernizing core to not use jQuery at all, etc) in #37110, regarding updating to jQuery 3.x.

One comment, by @desrosj (about work done with @clorith) stood out to me in that it seems to have done some sort of static analysis across the plugin repo. https://core.trac.wordpress.org/ticket/37110#comment:176

With Plugin Check and more tooling around these days, I figure that even more comprehensive scanning could be done now.

Last edited 9 months ago by nickchomey (previous) (diff)

#38 in reply to: ↑ 34 ; follow-up: @masteradhoc
9 months ago

Replying to TobiasBg:

I tentatively moved this to milestone 7.0. Given that we are still in the alpha phase, it might good to implement this soon, to get lots of testing.

+1 on getting this merged early here and writing a deeper post on the blog to let plugin/theme authors know early of this planned change.

#39 in reply to: ↑ 34 @siliconforks
9 months ago

Replying to TobiasBg:

I tentatively moved this to milestone 7.0. Given that we are still in the alpha phase, it might good to implement this soon, to get lots of testing.

That seems really...optimistic. jQuery 3.0 was released in 2016, but it was not until 2020 that WordPress finally updated to jQuery 3.x (see #50564).

According to this comment, jQuery Migrate 3.6.0 "will prepare to a future migration to jQuery 4 much better by warning against many more breaking changes." But WordPress is still using jQuery Migrate 3.4.1. Wouldn't it be better to update to jQuery Migrate 3.6.0 first, before trying to update to jQuery 4?

#40 in reply to: ↑ 38 @westonruter
8 months ago

  • Focuses performance removed
  • Keywords early added
  • Milestone 7.0 → Future Release

Replying to masteradhoc:

Replying to TobiasBg:

I tentatively moved this to milestone 7.0. Given that we are still in the alpha phase, it might good to implement this soon, to get lots of testing.

+1 on getting this merged early here and writing a deeper post on the blog to let plugin/theme authors know early of this planned change.

We're not early in the 7.0 release cycle anymore as the first beta is just a couple weeks away (February 19). Given this and since there is no patch yet, I'm moving to Future Release but adding early keyword to make clear it should land as soon as 7.0-RC1 is published and trunk is 7.1-alpha.

This ticket was mentioned in ​Slack in #core by audrasjb. ​View the logs.


8 months ago

This ticket was mentioned in ​Slack in #forums by dd32. ​View the logs.


8 months ago

#43 @desrosj
8 months ago

  • Milestone Future Release → 7.1

I've gone and created a 7.1 milestone in Trac, which I'm moving this ticket into as a way to prevent it falling into the abyss of the Future Release backlog.

This ticket was mentioned in ​Slack in #core by adrianduffell. ​View the logs.


3 months ago

#45 @adrianduffell
3 months ago

  • Milestone 7.1 → Future Release

This was discussed in yesterday’s bug scrub and unfortunately, we will need to punt this again as we are now in the 7.1 beta.

It looks valuable to pick up early in the 7.2 cycle. Seems a good next step is to update jQuery Migrate to 3.6.0 to help users prepare for jQuery 4.

#46 @wildworks
2 months ago

  • Milestone Future Release → 7.2

Let's explicitly set the milestone to ensure this ticket is not missed in the 7.2 release.

This ticket was mentioned in ​Slack in #core by audrasjb. ​View the logs.


3 weeks ago

#48 @audrasjb
3 weeks ago

As per today's bug scrub:

The first step is probably to update jQuery Migrate, to 3.6.0, which is perhaps not impossible before early October. So we can ship it in 7.2 and plan to update jQuery in 2027.

@Clorith is going to take ownership on this one.

#49 @peterwilsoncc
3 weeks ago

  • Owner set to Clorith
  • Status new → assigned

This ticket was mentioned in ​PR #13787 on ​WordPress/wordpress-develop by ​@Clorith.


11 days ago
#50

  • Keywords has-patch added; needs-patch removed

This removes the manually added jQuery Migrate files from the pseudo enqueue directory (src/js/_enqueues) which are copied directly over as part of the build process.

It instead moves to using NPM for the package, and updates the build scripts to leverage the node_modules directory files instead.

It also updates the jQuery Migrate version to the latest in the 3.x branch to expose any more warnings in preparation of upgrading to jQuery 4.x in an upcoming core release.

Trac ticket: https://core.trac.wordpress.org/ticket/60478

#51 @Clorith
11 days ago

As remarked in the PR text, the attached patch upgrades jQuery Migrate to 3.6.0, the plan is to do the upgrade of this, along with a devnote outlining the plan to roll over to jQuery and jQuery Migrate 4.x in the upcoming WordPress 7.3 release.

This gives us time to properly inform extenders that more deprecations may be flagged by jQuery Migrate, and the plans to move forward with the next release so that they ahve time to update ahead of time.

As jQuery 4.0 removes long-deprecated methods, a quick scan was done over on Veloria to check the impact the upgrade would have. There are some false positives (mostly relating to attempting to catch .bind and .unbind calls), but many of the biggest plugins and themes would be impacted by a few of the deprecated methods that are now removed, most of them appear to be added by 3rd party libraries they make use of though.

(I also opted to move jQuery Migrate over to being fetched from NPM like we now do with jQuery at the same time, it just makes maintainability a little bit easier since we don't need big file diffs for what is an external library)

#52 @peterwilsoncc
11 days ago

The ​linked pull request looks good to me.

@jorbin @desrosj @johnbillion pinging you as the most active build tools maintainers to make sure you are happy with moving jquery-migrate to an NPM dependency?

#53 @jorbin
10 days ago

@jorbin @desrosj @johnbillion pinging you as the most active build tools maintainers to make sure you are happy with moving jquery-migrate to an NPM dependency?

No objections from me. Looking at #50564 I can't find any mention of why it wasn't included as an NPM dependency to begin with, so it looks like this may have just been an over site at the time.

#54 @peterwilsoncc
10 days ago

  • Milestone 7.2 → Future Release

I've created #66203 for the upgrade to jQuery Migrate and moved this ticket to future release so it can be actioned during the 7.3 release cycle.

#55 @peterwilsoncc
10 days ago

In 63983:

External Libraries: Update jQuery Migrate to 3.6.0.

Updates jQuery Migrate from 3.4.1 to 3.6.0. This also removes the library from the committed src/js/_enqueues/vendor/jquery/ directory in favour of updating via NPM.

This is the first step in the upgrade path for jQuery 4.0.

Developed in ​https://github.com/WordPress/wordpress-develop/pull/13787.

Props clorith, jorbin, mukesh27, westonruter.
Fixes #66203.
See #60478.

​@peterwilsoncc commented on ​PR #13787:


10 days ago
#56

Merged r63983 / ​https://github.com/WordPress/wordpress-develop/commit/c3b186c2c61cd86150da46323e425d468063d9de

I created trac-66203 for updating the jQuery Migrate ticket and committed against that rather than the jQuery 4.0 upgrade ticket.

This ticket was mentioned in ​Slack in #core by audrasjb. ​View the logs.


33 hours ago

This ticket was mentioned in ​Slack in #core by im3dabasia1. ​View the logs.


5 hours ago

Note: See TracTickets for help on using tickets.