Plugins Plugin hub Backup SEO Caching Security Forms WooCommerce Images Best backup plugins
Hosting Hosting directory Shared Managed Cloud India
Themes & builders Compare Rank Math vs Yoast
Tools All tools Hosting finder Plugin stack builder Cost calculator Salt generator Theme detector Who is hosting this? Speed test Headline analyzer robots.txt generator Redirect generator Uptime calculator Blog name generator
Best lists Best backup plugins Deals
Guides All guides Speed up WordPress Choose hosting Back up WordPress
How we test

Troubleshooting · Troubleshooting

How to Fix WP Rocket Breaking Layout or Scripts

Short answer

WP Rocket usually breaks a site through one File Optimization setting: Delay JavaScript execution, deferred JavaScript, minified files, or Remove Unused CSS. Add ?nowprocket to the page URL to confirm the plugin is the cause, then switch the settings off one at a time, exclude the affected file, and clear the cache.

Key takeaways

  • Add ?nowprocket to a page URL to load it without WP Rocket's optimizations.
  • Delay JavaScript execution waits for a mouse move, scroll, touch, or key press before running scripts.
  • Safe Mode for Delay JavaScript keeps jQuery and theme scripts running while you find the bad file.
  • Remove Unused CSS needs a valid licence and a public site, and it times out after 45 seconds.
  • Turn settings back on one at a time: the first one that breaks the page is the culprit.
  • WP Rocket needs PHP 7.3 or later, WordPress 5.8 or later, and Action Scheduler 3.0.0 or later.

What does WP Rocket change on your site?

WP Rocket caches pages and rewrites how CSS and JavaScript load, so one setting can change when scripts run.

Page caching serves a saved HTML file instead of running WordPress, while file optimization minifies, defers, delays, or trims CSS and JavaScript. Most breakage comes from the second half, not the cache.

WP Rocket needs PHP 7.3 or later, WordPress 5.8 or later, and Action Scheduler 3.0.0 or later. The Installing WP Rocket guide lists those minimums, so check them before blaming a setting.

SettingWhat it doesTypical breakage
Delay JavaScript executionHolds scripts until the visitor interactsMenus, sliders, and forms do nothing until scroll or click
Load JavaScript deferredRuns scripts after the page parsesjQuery is not defined errors
Minify JavaScriptStrips whitespace and commentsOne mangled file breaks the bundle
Remove Unused CSSKeeps only the CSS each page usesHidden tabs and popups lose styling
LazyLoadLoads images and iframes on scrollHero images appear late or never

How do you prove WP Rocket is the cause?

Add ?nowprocket to the end of the page URL and load it: the page opens without WP Rocket's optimizations.

If the page works with ?nowprocket and breaks without it, the plugin's optimizations are the cause. If it breaks both ways, the fault sits elsewhere.

Test while logged out, in a private window. Optimizations do not run for logged-in users, so a logged-in test can hide the problem.

If a page builder will not load at all, the cause may sit in the builder rather than the cache. See How to Fix a Page Builder That Won't Load in WordPress.

How do you find the one setting that breaks the page?

Switch off every option in the File Optimization and Media tabs, clear the cache, and switch them back on one at a time.

The first setting that brings the breakage back is the culprit. Note it, then leave it off while you find the exact file to exclude.

Open the browser console first and fix any errors already there. WP Rocket's Troubleshoot Delay JavaScript execution issues guide says pre-existing console errors can interfere with the whole process.

WordPress's Debugging in WordPress guide explains the debug constants if the console points to a PHP error instead.

How do you fix Delay JavaScript execution?

Exclude the affected script from the delay, so it runs at once while the rest still waits for interaction.

Delay JavaScript execution holds back every script and inline script until the visitor moves the mouse, touches the screen, scrolls, presses a key, or scrolls with the wheel. The Delay JavaScript execution guide lists those triggers and notes the delay applies only on cached or optimized pages.

First confirm the delay is the cause: turn off every other File Optimization option, keep Delay JavaScript on, and check the page. Then turn Delay JavaScript off and confirm the page heals. WP Rocket's troubleshooting guide gives exactly that test.

Use the One-click exclusions for your theme, plugin, or service first. If that is not enough, add the file URL or a keyword from it to the Excluded JavaScript Files box.

Safe Mode is the fast fallback: it spares scripts under /wp-content/ and /wp-includes/, jQuery and jQuery Migrate, and inline scripts added with wp_add_inline_script. The Delay JavaScript execution guide warns to use it only while you find the specific files to exclude.

A problem that only looks late is cosmetic: a slider that appears after a scroll still works. A menu that never opens is a real break, and it needs an exclusion.

How do you fix deferred or minified JavaScript?

Exclude the file that fails, or switch the option off for the page where it breaks.

Deferred scripts run after the page parses, in document order, so an inline script that calls jQuery can run before jQuery exists. The console then shows jQuery is not defined, and everything after that line stops.

Find the failing file in the console: the error names it on the right side. Add its path to the Excluded JavaScript Files box, clear the cache, and retest.

Minify strips whitespace and comments, and a file that depends on automatic semicolon insertion can break. Excluding that one file from minification fixes it without losing the gain elsewhere.

WordPress's Debugging in WordPress guide documents SCRIPT_DEBUG, which loads unminified script versions while you track the fault.

Elementor pages are a common casualty, since the builder's scripts must run in order. See How to Fix Elementor Not Loading in WordPress.

How do you fix Remove Unused CSS?

Turn Remove Unused CSS off for the broken page, or exclude the stylesheet that loses its rules.

Remove Unused CSS sends pages to WP Rocket's service, which builds the CSS the page uses and stores it on your server. It needs a licence, a public site, and an uncached page that loads in under 45 seconds. The Troubleshoot Used CSS generation issues guide lists those checks.

Generation runs in batches of up to 100 new URLs every 60 seconds, with at most 300 URLs queued at once. A large site simply takes a while, so wait before calling it broken.

If a security plugin blocks the service, generation stalls with no used CSS at all. The same guide says to allow-list the service's user agents and IP addresses, and to switch Wordfence to Learning Mode while it runs.

WP Rocket is a paid plugin, and cloud features such as Remove Unused CSS stop working when the licence lapses. The WP Rocket pricing page lists the current plans.

How do you fix a stale page after an edit?

Purge the cache from the top down: CDN first, then server cache, then WP Rocket.

WP Rocket is the last cache in the chain, not the first. Clearing it alone changes nothing while a CDN or server cache still holds the old page.

Use the Clear Cache button in the admin bar after each edit, and check the page in a private window. If the page still shows old content, the stale copy lives above WP Rocket.

A slow admin after heavy caching work can look like a cache fault. See How to Fix a Slow Admin Dashboard in WordPress if the dashboard itself drags.

When should you contact WP Rocket support?

Contact support when one setting breaks the page and no exclusion fixes it.

Send them the page URL, the setting you isolated, and the console error. That is the same evidence their docs ask you to collect before opening a ticket.

Contact support too when Remove Unused CSS stays queued for hours on a small site, or when the licence will not validate. Both point to the cloud service, not your settings.

If the breakage survives with WP Rocket off, run a plugin conflict test instead. See How to Fix Plugin Conflicts in WordPress.

What mistakes should you avoid?

Do not switch on every optimization at once, and do not exclude whole folders to fix one file.

  • Turning on Delay JavaScript, defer, minify, and Remove Unused CSS together: you cannot tell which one broke the page.
  • Excluding jQuery from every optimization by default: most sites need it delayed like the rest.
  • Testing while logged in: optimizations skip logged-in users, so the bug stays hidden.
  • Leaving Safe Mode on for good: it is a temporary step while you find the exact files.
  • Purging only WP Rocket when a CDN sits above it: the stale page comes back at once.

Frequently asked questions

Does WP Rocket break Elementor?

It can, when Delay JavaScript or deferred scripts change the order Elementor's scripts run in. Use the Elementor one-click exclusion under Delay JavaScript, or exclude the builder's files, then retest the page while logged out.

Why does my menu only work after I scroll?

Delay JavaScript execution holds scripts until the first interaction, so a menu script has not run yet. Exclude the menu script from the delay, or use Safe Mode while you find the exact file.

Is Remove Unused CSS safe for page builders?

Mostly, but builder sections hidden on load can lose their CSS. If tabs, accordions, or popups lose styling, exclude the builder's stylesheet or switch the feature off for that page.

Will clearing the cache fix a broken layout?

Only if the layout broke from a stale file. Clearing the cache does not fix a script that runs in the wrong order. Find the setting first with ?nowprocket, then exclude the file.

Can I use WP Rocket with another caching plugin?

No. Two page caches fight over the same pages and produce stale or broken output. Remove the other caching plugin fully before you switch WP Rocket on.

Sources

  1. Delay JavaScript execution WP Rocket Docs
  2. Troubleshoot Delay JavaScript execution issues WP Rocket Docs
  3. Troubleshoot Used CSS generation issues WP Rocket Docs
  4. Installing WP Rocket WP Rocket Docs
  5. Debugging in WordPress WordPress.org
  6. Debugging in WordPress WordPress Developer Resources
  7. WP Rocket Pricing & Licenses WP Rocket

Is your product missing, or something out of date?

Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.

About the editors

WPLegible editors

Researched from the primary sources listed above and checked against our editorial rules. About the site · How we test