25

While checking the source code, I saw that WordPress uses jQuery v1.12.4. Why does WordPress use this outdated version of jQuery?

  • 1
    The answer is very simple: WP wants to maintain backward compatibility with older browsers. WP has enough users that still need IE8 support that they can't drop it yet. – Simba Nov 1 '16 at 9:57
32

There are many themes and plugins using jQuery as loaded by WP core. Every time jQuery is updated, there is a risk of older themes and plugins breaking (because lots of them are still used but no longer updated). That's why you also see jquery-migrate.js in your source code. It's a script that catches old functions used by plugins/themes and makes sure that they still work in newer versions of jQuery.

Moving to the jQuery 3.x family would cause many plugins/themes to break, because it's not possible to have a migration script for everything that is deprecated. This is why new versions of the 1.x family were still being developed while the 2.x and 3.x families already existed. There will be no new 1.x and 2.x versions after 1.12 and 2.2, except for (security) patches. Though jQuery 1.12 is not outdated right now, it will be in the near future.

So, WordPress is in a bind. If it does not upgrade to a higher jQuery version, it cannot keep up with new possibilities. However, if it does upgrade, older sites will break. The most likely outcome is that WP will wait for a couple of years, so older themes/plugins will be phased out anyway, and then jump to the 3.x family.

Clarification

The above might suggest that migrating from 1.x versions to 3.x is not actually possible. That's not true. It's just a bit complicated. The trick is to first upgrade to 1.12, debug the result using the older migration script and then add the 3.0 migration script, which does work with 1.12. Detailed instructions here.

Security update

Developers will notice that Google Dev Tools / Lighthouse reports WordPress sites as vulnerable due to the presence of this older jQuery version - or so it seems. In effect, all Lighthouse does is check whether this library has vulnerabilities mentioned in the Snyk Vulnerabilities Database. If you check this in detail you will find that version 1.12.4 is clean. Given the wide spread use of 1.12.4 you can count on any serious vulnerability being dealt with swiftly.

  • 4
    Just to add a little bit of extra info - both jQuery 1.x and 2.x were actively being updated until May this year, the difference between them was simply that 1.x had compatibility for IE8, and 2.x removed the patches and fixes for those buggy browsers. 3.x is the new version, and takes things one step further by changing various interfaces to be compatible with the "official" HTML5 / JavaScript interfaces (ie, where it did things the same way, things became standard after jQuery had it's own versions doing the same sort of thing). – Rycochet Nov 1 '16 at 9:22
23
  • It's not outdated
  • Moving to 2.x or 3.x is too early, people still use IE8 which is only supported on 1.x
  • 2
    @LightnessRacesinOrbit Agreed but from my experience this question is spot on in regards to the average caliber of a WP developer. – MonkeyZeus Oct 31 '16 at 18:49
  • 7
    Update for Jan 2018: The idea that it is outdated despite still being the default included with WordPress is no longer "nonsense". XSS vulnerabilities have been identified with 1.12.4 and the 1.x branch is no longer receiving updates. The recommended remediation is to upgrade to jquery 3.x snyk.io/test/npm/jquery/… – squarecandy Jan 17 '18 at 17:28
  • 2
    Also when using Lighthouse Google is telling you that version 1.12.4 contains known security vulnerabilities so you shouldn't be using it. – phpheini Jun 26 '18 at 9:25
  • 4
    Supporting IE8, which Microsoft doesn't even do is at this point irresponsible. It keeps people using an outdated browser with security issues. If someone is using IE8 they need to stop. – David A. French Dec 18 '18 at 1:50
  • 1
    @DavidA.French I second the motion. Devs need to STOP accommodating users who refuse to update. There was a time when everyone aspired to have total compatibility across every known possible browser, and those bad habits continue to persist. Maybe when the interwebs stop working for them, those people will update to a modern browser. At this point if you're not on the latest version of one of the major browsers (IE & AOL don't count at all) the internet shouldn't bend for you. Honestly IE8? You're like less than 1% of the web, [spoken in AOL] "Goodbye" – KFish Aug 29 at 4:19
0

To be even more correct.

The 1.x branch includes support for IE 6/7/8 and the 2.x branch does not.

https://blog.jquery.com/2016/05/20/jquery-1-12-4-and-2-2-4-released/

  • This is not a full answer. – Flimm May 29 at 9:57
  • 2
    That's the most prominent reason to drop it. – KFish Aug 29 at 4:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.