While checking the source code, I saw that WordPress uses jQuery v1.12.4. Why does WordPress use this outdated version of jQuery?
There are many, 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
3.x families already existed. There will be no new
2.x versions after
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
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.
- 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
To be even more correct.
The 1.x branch includes support for IE 6/7/8 and the 2.x branch does not.
I used https://wordpress.org/plugins/jquery-updater/ to solve Lighthouse Report security warning