On this page
What this issue is
A caching plugin speeds up your site by storing ready-made pages and by changing how files load. Two JavaScript features cause most problems: minify/combine, which squashes many script files into one, and delay/defer, which postpones scripts until the visitor interacts or the page has loaded.
Scripts often depend on each other and on loading in a set order. When the plugin changes that order or merges files, one script can fail with an error such as jQuery is not defined, and everything after it stops working. The page still looks fine, so the break is easy to miss.
The settings usually involved are WP Rocket's Minify JavaScript files, Combine JavaScript files, Load JavaScript deferred and Delay JavaScript execution, and LiteSpeed Cache's JS Minify, JS Combine, Load JS Deferred and Delay Load JS.
Why it costs you leads or sales
The pages most affected are the ones that rely on JavaScript to convert: contact forms, multi-step forms, add-to-cart and checkout buttons, booking widgets, popups and chat. If the script fails, the button does nothing or the form never submits. Visitors do not report it. They leave.
Tracking can break too. Delaying scripts can stop the GA4, Google Ads or Meta tags from firing, or make them fire late so quick visitors are never counted. Your ad platforms then optimise on missing conversions.
- Ad clickVisitor lands on the page
- Page loadsLooks normal
- Script combined or delayedDependency order breaks
- Form submitsButton does nothing
- Conversion tagNever fires
The page loads, but the optimised script fails, so the form and the conversion tag never run.
Example: illustrative numbers showing a drop after a caching setting change.
How to check if your site has it
Open the page in a private window
Log out of WordPress or use an incognito window. Logged-in admins often bypass the cache and optimisations, so the problem only shows for visitors.
Open the browser console
Press F12 (or right-click, Inspect), then open the Console tab and reload. Look for red errors such as
Uncaught ReferenceError: jQuery is not definedorUnexpected token.Test the key action
Submit the form, click the add-to-cart or booking button, open the chat widget. Note which ones fail.
Compare with optimisation off
Add
?nowprocketto the URL for WP Rocket, or?LSCWP_CTRL=NOCACHEfor LiteSpeed (this needs the plugin's debug or admin settings in some setups). If the page works with it, the plugin is the cause.Check your tracking
Use the Network tab and filter for
collect,googleadsorfacebookto see whether the tracking requests are sent.
How to fix it
The safe method is to switch off the riskiest options first, confirm the site works, then turn features back on one by one. Take a backup or work on a staging copy if you can.
WP Rocket: turn off the risky options
Go to Settings, WP Rocket, File Optimization. Untick Combine JavaScript files, Load JavaScript deferred and Delay JavaScript execution. Save and clear the cache. Test the form and tracking.
WP Rocket: turn options back on one at a time
Re-enable one option, clear the cache, test again. When it breaks, you have found the cause.
WP Rocket: add exclusions
Under Delay JavaScript execution or Excluded JavaScript Files, add part of the script path or keyword of the failing script (for example the form plugin's file name,
jquery.js, or your tracking script). Exclude only what is needed so you keep the speed gain.LiteSpeed Cache: turn off the risky options
Go to LiteSpeed Cache, Page Optimization, JS Settings. Set JS Combine, Load JS Deferred and Delay Load JS to Off. Save, then use Toolbox, Purge All.
LiteSpeed Cache: exclude the script
Use the JS Excludes, JS Deferred / Inline JS Excludes and Delay Load JS Excludes fields to list the failing script. Re-enable options one at a time and test after each.
Exclude the GTM container script
If tags fire late or not at all, add
googletagmanager.com/gtm.jsand yourdataLayerinline code to the plugin's delay or defer exclusions, so tracking loads on time.Check in Preview mode
Open GTM Preview, load the page as a visitor and confirm the container loads and the expected tags fire.
Mark a script as never optimised
WP Rocket skips scripts with the attribute
data-no-minify="1"and LiteSpeed skips those withdata-no-optimize="1". Add the right attribute to scripts you load yourself.Fix dependencies when you enqueue
Make sure
wp_enqueue_scriptlists real dependencies (for examplearray('jquery')) so the load order is correct.
<!-- WP Rocket -->
<script src="/path/to/form.js" data-no-minify="1"></script>
<!-- LiteSpeed Cache -->
<script src="/path/to/form.js" data-no-optimize="1"></script>How to confirm it's fixed
- Cache purged in the plugin and, if you use one, at your host or CDN
- No red errors in the browser console on the affected pages
- Form submits and shows its thank-you message or page
- Test lead arrives in the inbox and CRM
- Add-to-cart, checkout and booking buttons work
- Tracking requests for GA4, Google Ads and Meta appear in the Network tab
- Checked in a private window and on mobile
How to prevent it happening again
Treat every change to cache settings, and every plugin or theme update, as a possible break. Test the money pages afterwards, not just the homepage.
- Change one optimisation setting at a time and test after each
- Use a staging site for cache and update changes
- Keep a list of scripts you excluded and why
- Purge the cache after every plugin, theme or setting change
- Test forms, checkout and tracking from a logged-out browser after updates
- Run an automated check of your key journeys on a schedule
How FunnelGuard handles this
FunnelGuard detects this today. It does not read your cache settings. It runs your real journeys as a logged-out robot visitor, so it sees what a customer sees after your caching plugin has rewritten the scripts. If a form button stops working, a step fails, or the tracking hits to GA4, Google Ads, Meta or other platforms are no longer sent, the check fails.
A failure is re-checked from a second region before one alert goes out, with a screenshot and a likely cause. That helps you catch a break soon after an update or a settings change. The Free plan covers 1 site and 2 journeys with daily checks and no card.
The caching plugin holds the script back, so the tracking tag does not send its hit.
Delay on, no exclusions
Leads or data lost
The form script waits for interaction, submissions fail and conversion tags may not fire.
Toggle to see how excluding the key scripts changes the outcome.
Questions people ask
Why is my form not working after installing WP Rocket?
Most often WP Rocket's Delay JavaScript execution, Combine JavaScript files or Load JavaScript deferred is changing how the form's script loads. Turn those options off, clear the cache and retest. Then re-enable them one at a time and exclude the script that breaks.
How do I exclude a JavaScript file from WP Rocket?
Go to Settings, WP Rocket, File Optimization and add part of the script's path to Excluded JavaScript Files or the Delay JavaScript execution exclusion list. You can also add data-no-minify="1" to scripts you load yourself. Save and clear the cache.
Why is my LiteSpeed Cache breaking my site's JavaScript?
JS Combine, JS Minify, Load JS Deferred and Delay Load JS under Page Optimization, JS Settings can reorder or merge scripts and break dependencies. Switch them off, purge all, then re-enable one at a time and use the exclude fields for the script at fault.
How can I tell if a caching plugin is causing the problem?
Load the page in a private window and check the browser console for red errors. Then test with the plugin's optimisation off, for example the ?nowprocket URL parameter in WP Rocket. If the problem disappears, the cache plugin is involved.
Can a caching plugin stop my Google Ads or Meta tracking?
Yes. If it delays or defers the tag script, the tag may fire late or not at all, so conversions go unrecorded. Exclude your tag manager or tracking script from delay and defer, then confirm the requests appear in the Network tab.
Do I need to clear the cache after changing JavaScript settings?
Yes. Cached files can keep serving the old broken version. Purge the cache in your plugin, and at your host or CDN if they have their own cache, then retest in a private window.
Should I stop using a caching plugin altogether?
Usually not. The speed benefits are real. Keep the safe settings, switch off the JavaScript options that cause trouble, and exclude only the scripts that need to load normally.
How can I be alerted if a cache setting breaks my forms?
FunnelGuard runs your form and checkout journeys on a schedule as a logged-out visitor, checks the tracking hits and test leads, and alerts you with a screenshot if a step fails.
Related issues
- OPS-234Plugin auto-update breaks contact formFix guide
- OPS-235Theme update overwrites customisations / tracking codeFix guide
- OPS-236Page builder (Elementor/Divi) update breaks layout or formsFix guide
- OPS-237Contact Form 7 / WPForms / Gravity Forms mail settings brokenFix guide
- OPS-241Plugin conflict causing white screenFix guide
- OPS-251WP REST API disabled breaking block formsFix guide