WP Rocket Broken Layout - Find the Setting and Add the Right Exclusion (2026)

A broken layout after enabling WP Rocket settings is common and fixable. The trick is finding the one setting responsible and adding a targeted exclusion, so you keep the rest of the speed boost.

Don't Panic: It's Reversible

Every WP Rocket optimization can be switched off, and clearing the cache brings the page back to how it was. Nothing is permanently changed in your theme or content.

The goal isn't to turn features off for good. Remove Unused CSS and Delay JavaScript are among the most valuable settings for Core Web Vitals, so it's worth a few minutes to fix the conflict properly.

Step 1: Confirm WP Rocket Is the Cause

Illustration for Step 1: Confirm WP Rocket Is the Cause on the WP Rocket Broken Layout page, showing a layout diagram

Add ?nowprocket to the end of the broken page's URL, for example yoursite.com/page/?nowprocket. WP Rocket's documentation describes this as a way to load the page without its file optimizations.

Always test logged out in a private window, because logged-in visitors see uncached pages.

Step 2: Isolate the Setting

  1. List what you enabled

    Write down every WP Rocket option you've turned on.

  2. Turn one off

    Start with the most recently enabled setting.

  3. Clear the cache

    Clear WP Rocket's cache, plus your host or CDN cache if they're in use.

  4. Test the page

    Check it logged out in a private window.

  5. Repeat

    Turn options off one at a time until the problem disappears.

  6. Turn the others back on

    Keep everything except the culprit enabled, then fix that setting with an exclusion.

Step 3: Apply the Right Fix

Symptoms, likely settings and fixes
SymptomLikely SettingFix
Missing styles, unstyled sections, wrong fontsRemove Unused CSSAdd the missing selectors to the CSS safelist, then clear Used CSS
Brief flash of unstyled contentLoad CSS Asynchronously or Remove Unused CSSCheck critical styles; safelist dynamic classes
Menu, slider, tabs or accordion don't respondDelay JavaScript executionUse one-click exclusions or exclude the script
Script errors in the consoleLoad JavaScript deferred or minifyExclude the file from defer or minification
Images missing or appearing lateLazy loadingExclude the image, especially above the fold
Layout jumps on scrollAutomatic Lazy Rendering or lazy loadingClear Priority Elements, then exclude the element if needed
Background images missingLazy load for CSS background imagesExclude that background element

Fixing Remove Unused CSS Issues

Illustration for Fixing Remove Unused CSS Issues on the WP Rocket Broken Layout page, showing a layout diagram

Remove Unused CSS keeps only the CSS each page uses. Elements that appear later, like a mobile menu, a popup, a cookie banner or content added by JavaScript, can lose their styles if their classes weren't detected.

The fix is the CSS safelist. Inspect the broken element in your browser's developer tools, find its classes, and add them to the safelist, for example .mobile-menu or a pattern like .popup-(.*). WP Rocket's docs note that safelisting isn't instant, since used CSS has to regenerate.

If you can't find the right selectors, switch that site to Load CSS Asynchronously, which loads the full stylesheet after critical CSS. It's less aggressive and less likely to break layouts. See reducing unused CSS.

Fixing Delay JavaScript Issues

Delay JavaScript holds scripts until the visitor interacts. Elements that must work immediately, like a slider at the top of the page or a menu toggle, can stop working until someone scrolls or clicks.

Use WP Rocket's one-click exclusions first. They list known plugins, themes and services with tested exclusions. If your script isn't listed, add its file path or a keyword to the exclusion box. Our Delay JavaScript exclusions guide has examples for common page builders and plugins.

Fixing Defer and Minify Issues

Some scripts expect to run in a certain order, often because they depend on jQuery being loaded first. If deferring breaks them, exclude the specific file from Load JavaScript deferred.

Minification rarely breaks modern files but can affect older plugins. Exclude the problem file from minification rather than turning minification off sitewide.

Fixing Lazy Loading Issues

Illustration for Fixing Lazy Loading Issues on the WP Rocket Broken Layout page, showing a image diagram

Lazy loading above-the-fold images slows down LCP and can make images appear late. WP Rocket automatically optimizes critical images, but if your hero image is a CSS background or loaded by a slider, you may need to exclude it.

Add the image's file name or a class to the lazy load exclusions. Sliders and galleries that load images with JavaScript sometimes need their own exclusion too.

Common Culprits by Site Type

Page builders

Elementor and Divi animations, sliders and popups often need Delay JavaScript exclusions. See speeding up Elementor and speeding up Divi.

WooCommerce

Product galleries, variation selectors and mini-carts depend on scripts. Use one-click exclusions for WooCommerce.

Sites with ads

Ad slots above the fold may need excluding from delay so they render on time. See sites with ads.

Cookie and consent banners

Often need both a JavaScript exclusion and a CSS safelist entry.

A Worked Example: A Mobile Menu That Won't Open

After enabling Delay JavaScript, a site's mobile menu button stops working until the visitor scrolls. The ?nowprocket test fixes it, confirming WP Rocket is involved.

Turning off Delay JavaScript fixes the menu too, so that's the setting. The owner turns it back on and checks the one-click exclusions list for their theme. Selecting the theme's exclusion makes the menu script load straight away while other scripts stay delayed. The menu works, and the page keeps its INP and TBT improvements.

A Worked Example: Missing Styles After a Theme Update

A theme update adds a new header style. After the update, the header looks unstyled on some pages. That's because Remove Unused CSS generated used CSS before the new classes existed.

Clearing Used CSS from WP Rocket's admin bar menu fixes it: WP Rocket regenerates the CSS for each page with the new classes included. If a dynamic element still loses its styles, its classes go in the safelist.

Preventing Broken Layouts

Conflicts With Other Optimization Plugins

Running two tools that optimize CSS or JavaScript is a frequent cause of broken layouts. If you use Autoptimize, Perfmatters, a theme's built-in optimization or Cloudflare's Rocket Loader alongside WP Rocket, make sure each optimization is done in one place only. WP Rocket's docs specifically recommend disabling third-party CSS optimizations when troubleshooting Remove Unused CSS.

WP Rocket Broken Layout FAQ

Why did WP Rocket break my site's layout?

Usually one optimization, most often Remove Unused CSS or Delay JavaScript, affects an element that loads dynamically. A targeted exclusion fixes it.

How can I check if WP Rocket is causing the problem?

Add ?nowprocket to the page URL. If the page works, a WP Rocket optimization is involved.

Should I just turn off Remove Unused CSS?

Try the CSS safelist first. If that doesn't work, Load CSS Asynchronously is a gentler alternative.

My menu only works after I scroll. Why?

Delay JavaScript is holding the menu script. Exclude it using one-click exclusions or the exclusion box.