Audit WordPress plugins for jQuery 4 compatibility
Published 4 min read
jQuery Migrate 3.6.0 ships as part of WordPress 7.2. It sits between plugin code and jQuery itself, intercepting calls to deprecated APIs and logging a browser console warning before allowing the call to proceed. A plugin that uses .bind() to attach event handlers, or calls $.parseJSON, works exactly as it always has. The warnings are there in the console; nothing has broken yet.
The timeline changes when jQuery 4 ships and Migrate is eventually disabled. The calls Migrate was silently handling become errors. The gap between now and that point is when an audit is worth running: a plugin can scan every JS file in your installed plugins and active theme against the deprecated pattern list, then report every file and line that will need attention.
The step the jQuery 3 migration never finished
In 2020, WordPress updated its bundled jQuery from 1.x to 3.x and shipped jQuery Migrate alongside it. The plan was to run Migrate for one or two releases while the ecosystem caught up, then disable it by default. That second step never happened. Plugins using .bind(), $.parseJSON and the other deprecated calls kept working because Migrate was still running, and without breakage there was no pressure to update them.
WordPress 7.2 resumes that process with jQuery Migrate 3.6.0, which covers the additional APIs that jQuery 4 removes on top of what jQuery 3 already deprecated. The difference from 2020 is that jQuery 4 already exists, the deprecation list is final, and disabling Migrate by default has a concrete path forward. Sites running 7.2 are logging those warnings now, against a larger list than before.
The calls the scanner flags, in order of frequency
.bind() and .unbind() top any audit of real plugin code. They were the standard event-attachment pattern in jQuery 1.x and most of jQuery 2.x; the replacement, .on() and .off(), arrived in jQuery 1.7 but was not widely adopted for years after. Any plugin written before 2015 will almost certainly use them. .delegate() and .undelegate(), the event-delegation counterparts, appear less often but for the same reason: they predate .on().
$.parseJSON() and jQuery.parseJSON() are deprecated because JSON.parse() does the same thing and has been in every browser since Internet Explorer 8. $.isFunction() and jQuery.isFunction() have no jQuery-specific behaviour; typeof fn === 'function' replaces them directly. At the bottom of the frequency list: .live() and .die(), removed back in jQuery 1.9. Finding these means very old code that survived every jQuery update since 2013.
Where the scanner's ceiling is
Commercial plugins typically ship minified JS: a build step that strips whitespace and shortens identifiers. The pattern .bind( in source becomes unrecognizable after minification. The scanner skips .min.js files because matching against them produces both false positives and false negatives in roughly equal measure. A plugin distributed only as a minified build shows no results, clean or otherwise.
Scripts loaded from external CDNs or assembled dynamically from PHP are also invisible to file-system scanning. The scanner reads what is on disk inside wp-content; anything else is out of scope. The result is a list to work from, with the most actionable items at the top: plugins shipping readable source are both the easiest to audit and the easiest to update.
If all your plugins come from actively maintained repositories, the developers will likely ship updates before jQuery 4 arrives in WordPress. The scanner earns its keep on sites running older premium plugins, abandoned freeware, or in-house code that has not been touched in years.
What you get
Included
- JS file scanning across all installed plugins and the active theme
- Nine deprecated call patterns flagged by jQuery Migrate 3.6.0
- Results grouped by plugin and theme with file path, line number and matched text
- Clean plugins listed explicitly so an absent name does not mean the scan missed it
- .min.js files skipped automatically with a note in the results
Not included
- Minified or bundled JS: patterns inside .min.js files are not scannable
- Scripts loaded from CDNs or dynamically generated by PHP
- Any fixing of flagged code: the plugin reports problems, not solutions
- Breaking changes in jQuery 4 unrelated to these nine patterns
- Inactive plugins or themes not currently applied to the site
Build it in Steem
The button opens the builder with this guide's prompt filled in, so you can change anything before it runs. Nothing is built, and nothing is charged, until you send it.
Read the prompt (128 words)
Build a WordPress plugin that scans installed plugins and the active theme for deprecated jQuery calls. Add an admin screen under Tools called jQuery Audit. When the page loads, scan all JS files inside wp-content/plugins and the active theme folder for these patterns: .bind(, .unbind(, .live(, .die(, .delegate(, .undelegate(, $.parseJSON, jQuery.parseJSON, $.isFunction, jQuery.isFunction. Skip files whose names end in .min.js. Display results grouped by plugin or theme: for each match show the filename relative to the plugin folder, the line number, and the matched text. Show a count of matches per plugin at the top of each group. Plugins and themes with no matches should still appear in the list marked as clean. Add a Rescan button at the top that re-runs the scan and refreshes the display.
Steem