This error usually shows up in a browser console as “Uncaught ReferenceError: jQuery is not defined” and it’s especially common on WordPress sites that use caching plugins or CDNs. The good news is it’s one of the more straightforward JavaScript errors to fix once you know where to look.
What’s Actually Happening
This error message indicates that your site can’t call a function from the jQuery JavaScript library, causing one or more website elements to stop running. In plain terms, something on your site — often a plugin or script — requires jQuery to function, but jQuery isn’t available when that script tries to run. Given how widely used the library still is, this isn’t a rare edge case either — around 80% of all websites run on jQuery in some form.
How Caching Specifically Causes This
Caching plugins and CDNs are frequent culprits because they optimize or serve stale versions of your scripts. Your browser might cache an old version of your webpage that didn’t include jQuery, or the path to jQuery might be incorrect, causing the library to fail to load.
CDN issues compound this. If you’re loading jQuery from a CDN and that CDN is down or unreachable, your site won’t be able to load the library, triggering the same error. Caching plugins often cache old versions of scripts too, which can cause this error specifically after you’ve made updates to your site.
Script optimization settings are another common trigger. The error means jQuery is required by another script, but due to optimization settings, it isn’t available when that initial script runs — which is what causes the reference error.
Step 1: Isolate Whether Caching Is the Cause
Before changing anything, confirm the caching layer is actually responsible.
If you’re using WP Rocket: load your page while bypassing WP Rocket by adding ?nowprocket to the URL, and check if the error still appears. If it does, WP Rocket isn’t the cause and the issue lies elsewhere in your setup.
If you’re using NitroPack: bypass the NitroPack cache by adding /?nonitro to the URL and check whether the error is still present on the non-optimized version of the page.
Step 2: Clear the Relevant Caches
Once you’ve confirmed caching is involved, clearing it in the right order usually resolves things:
- Plugin cache — if you’re using WP Rocket, W3 Total Cache, or LiteSpeed Cache, go into the plugin’s settings and click “Clear Cache.”
- Browser cache — hard-refresh your browser with Ctrl+Shift+R (or Cmd+Shift+R on Mac) to bypass local caching.
- CDN cache — if you’re using Cloudflare or another CDN, purge the cache directly from your CDN dashboard.
Step 3: Check Minification Settings
Script minification can sometimes strip or reorder code in a way that breaks jQuery’s load order. In WP Rocket, go to Settings → File Optimization, then uncheck “Minify JavaScript files” and save changes to see if that resolves the error.
Step 4: Exclude jQuery From Optimization Entirely
If clearing caches doesn’t fix it, excluding jQuery from your optimization tool is a more permanent solution. In NitroPack, for example: go to the Dashboard, then Cache Settings → Cache → Excluded Resources, and add jQuery’s file there so it’s no longer touched by the optimizer.
Step 5: Add a CDN Fallback
If your site loads jQuery from an external CDN, a fallback script protects against outages. You can add a snippet that falls back to a local copy of jQuery if the CDN version fails to load, preventing the error entirely when the CDN is temporarily unreachable.
Common Mistakes to Avoid
- Assuming the error is a plugin conflict and skipping the cache-bypass test first — this test takes seconds and immediately narrows down the real cause.
- Purging only the browser cache while forgetting the CDN or plugin-level cache, leaving stale files still being served.
- Disabling minification permanently instead of testing to confirm it’s actually the trigger, which can undo a real performance benefit for no reason.
Join The Discussion
Have you run into the jQuery is not defined error on a caching-related setup, and which step ended up fixing it for you? Share whether it was your caching plugin, a CDN, or a minification setting that turned out to be the culprit, and if you’ve set up a CDN fallback to prevent it from happening again, it’d be useful to hear how that’s held up over time.