WordPress 5.2.1 deactivated my jQuery

5.2.1 includes a backported fix from jQuery 3.4.0 (commit). Because they’re now using a modified version of jQuery they suffixed the version number with ‘-wp’:

$scripts->add( 'jquery', false, array( 'jquery-core', 'jquery-migrate' ), '1.12.4-wp' );

Your code tries to copy the jQuery version number from the existing registration

global $wp_scripts;
if (isset($wp_scripts->registered['jquery']->ver)) {
    $ver = $wp_scripts->registered['jquery']->ver;

The problem is that Google’s CDN won’t have a version of jQuery called 1.12.4-wp. The following URL

https://ajax.googleapis.com/ajax/libs/jquery/1.12.4-wp/jquery.min.js

doesn’t exist. The same URL without the ‘-wp’ does work. So the error you should be seeing in your browser console is a 404 loading jQuery from the CDN.

The jQuery patch is to fix Trac 47020 which is a security issue in jQuery.extend that could allow cross-site scripting attacks (“Minor vulnerability fix: Object.prototype pollution”). So you probably do want it, either by using WordPress’s patched version of 1.2.14 again or by updating to 3.4.0 (if that’s compatible with the rest of your site).

Leave a Comment