Troubleshooting
WP Rocket Remove Unused CSS Not Working: Causes and How to Fix It

Short answer
Remove Unused CSS fails when the used CSS has not finished generating, the license is inactive, WP Rocket's servers cannot reach your pages, or WP-Cron is not running. If styles go missing instead, add those selectors to the CSS safelist and clear the used CSS so it rebuilds.
Key takeaways
- Generation runs on WP Rocket's servers in the background.
- An active license and public page access are required.
- Disabled WP-Cron leaves pages stuck in the queue.
- Add missing dynamic element selectors to the CSS safelist.
- Clear used CSS after changing the safelist.
Why is WP Rocket Remove Unused CSS not working?
WP Rocket's Remove Unused CSS usually fails because the used CSS has not been generated yet, WP Rocket's servers cannot reach your pages, background tasks are not running, or styles for dynamic elements were stripped out.
The feature works in two stages. First, WP Rocket sends your page to its own service, which works out which CSS rules the page actually uses. Then it stores that smaller set of CSS and serves it in place of your full stylesheets.
So there are two kinds of problems:
- Generation problems. The used CSS never gets created, so nothing changes.
- Display problems. The used CSS is created, but parts of the page look broken.
Work out which one you have first. The fixes are quite different.
For background on the plugin's other options, see our guide to WP Rocket settings explained.
How do you tell which problem you have?
If the page looks the same and PageSpeed still flags unused CSS, generation failed; if the page looks broken after turning the feature on, it is a display problem.
| What you see | Problem type | Where to start |
|---|---|---|
| No change in page size or speed scores | Generation | Check license, access and background tasks |
| Status stuck on processing | Generation | Check cron and firewall |
| Missing menu, slider or popup styles | Display | Add selectors to the CSS safelist |
| Layout broken only on some pages | Display | Clear used CSS for those pages |
| Looks fine logged in, broken logged out | Display or cache | Test logged out in a private window |
WP Rocket keeps separate help pages for used CSS generation issues and display issues. Use them alongside the checks below.
Has the used CSS had time to generate?
Used CSS is generated in the background in batches, so on a fresh setup or large site it can take a while before every page gets its optimized CSS.
Until a page's used CSS is ready, WP Rocket serves it with your normal stylesheets. That is by design, so pages never load without styles.
After you enable the option, visit a few key pages while logged out, then wait. Check again later. On sites with thousands of URLs, the queue takes longer to clear.
You can see whether a page uses the optimized CSS by viewing its source. Optimized pages have the used CSS inlined in the head, and the original stylesheet links are removed.
Is your WP Rocket license active?
Remove Unused CSS runs on WP Rocket's servers, so it needs a valid, active license, and an expired or disconnected license stops new used CSS from being generated.
Go to Settings, then WP Rocket, and check the dashboard tab for your license status. If it shows expired or invalid, renew or reconnect it.
Also make sure the plugin is up to date. Old versions of WP Rocket may use an older version of the service. Our guide on how to update WP Rocket covers manual updates if the automatic one fails.
Can WP Rocket's servers reach your pages?
The service must be able to load your pages from the public internet, so password protection, maintenance mode, staging blocks or a firewall that blocks WP Rocket's servers will stop generation.
Common blockers include:
- A coming soon or maintenance mode plugin.
- Password protection on a staging site.
- A security plugin or host firewall rate-limiting unknown bots.
- Cloudflare security rules or bot protection that challenge automated requests.
- Country blocking that happens to cover the service's location.
Try loading a page from outside your network, for example with a free online page speed test. If that tool cannot load the page, WP Rocket's service probably cannot either.
If you use Cloudflare, check the security events log for blocked requests around the time generation should have run.
Are WordPress background tasks running?
WP Rocket processes the used CSS queue with WordPress cron and Action Scheduler, so if WP-Cron is disabled or broken, pages stay stuck waiting.
Open wp-config.php and look for DISABLE_WP_CRON. If it is set to true, your host must run a real server cron job that calls wp-cron.php. If no such job exists, scheduled tasks never run.
The WordPress cron documentation explains how WP-Cron works and how to replace it with a real cron job.
To see pending tasks, go to Tools, then Scheduled Actions, and search for rocket. Many failed or past-due actions point to a cron problem. The WP Crontrol plugin also lists scheduled events and lets you run them by hand.
How do you fix missing styles after turning it on?
Add the CSS selectors, files or stylesheets that go missing to the CSS safelist in WP Rocket's File Optimization settings, then clear the used CSS so it is rebuilt.
Remove Unused CSS looks at the page as it first loads. Elements added later by JavaScript, such as mobile menus, sliders, popups, cookie banners and tabs, may not exist at that moment. Their CSS looks unused, so it is removed.
To fix this:
- Open the broken page and find the missing element.
- Use your browser's developer tools to find its class or ID.
- Go to Settings, then WP Rocket, then File Optimization.
- Add the selector, such as .mobile-menu, to the CSS safelist.
- Save and clear the used CSS.
If you are not sure how to find selectors, MDN's intro to browser developer tools shows how to inspect an element.
How do you clear and regenerate the used CSS?
Use the Clear Used CSS option in WP Rocket's settings or the admin bar menu, which deletes the stored used CSS so pages are processed again with your new safelist.
Changing the safelist does not update pages that already have used CSS. You must clear it so the service runs again.
After clearing, also clear the page cache. Then visit the affected pages while logged out to queue them again.
If you use a CDN that caches HTML, purge it too. Otherwise visitors may keep seeing the broken version for a while.
Is another plugin or theme setting conflicting?
Other CSS optimization tools, such as theme or page builder CSS optimizations, host-level minification or a second performance plugin, can clash with Remove Unused CSS.
Run only one tool that removes or combines CSS. If your host or CDN offers its own minify or CSS optimization, try turning that off.
Page builders sometimes have their own improved CSS loading options. Test with those toggled off while Remove Unused CSS is on.
If WP Rocket's changes break the whole site rather than just styles, our guide on fixing WP Rocket breaking your site covers the wider set of options to test.
Should you use Load CSS asynchronously instead?
If Remove Unused CSS keeps breaking your layout or cannot generate, the alternative Load CSS asynchronously option is a reasonable fallback, though it usually saves less.
Both options sit under Optimize CSS delivery in the File Optimization tab, and you can only choose one.
Load CSS asynchronously creates critical CSS for above-the-fold content and loads the full stylesheet later. It avoids the problem of missing styles for dynamic elements, but it does not shrink the CSS file.
Test both on your key pages and keep whichever gives better real-world results. Our guide to removing unused CSS in WordPress compares other plugins and manual methods too.
When should you contact WP Rocket support?
Contact support when generation stays stuck after you have confirmed an active license, public access, working cron and a clean safelist.
Include the page URLs, a screenshot of the broken layout, and what you already tried. Support can check the service logs for your domain, which you cannot see yourself.
While you wait, you can turn off Remove Unused CSS for the affected pages through the page exclusion options, so visitors see a working site. For more speed settings, see our guide to configuring WP Rocket for Core Web Vitals.
Frequently asked questions
How long does WP Rocket take to generate used CSS?
It depends on how many pages you have and how busy the service is. Small sites often see results within minutes, while large sites can take much longer because pages are processed in batches in the background.
Why is my mobile menu broken after enabling Remove Unused CSS?
The menu's styles are applied by JavaScript after the page loads, so the service thinks they are unused and removes them. Add the menu's classes to the CSS safelist, save, then clear the used CSS so the page is processed again.
Does Remove Unused CSS work on staging sites?
Often not, because staging sites are usually password protected or blocked from public access. WP Rocket's service needs to load the page from the internet, so test this feature on a publicly reachable site.
Can I exclude a page from Remove Unused CSS?
Yes. WP Rocket lets you exclude specific URLs from the feature in its settings. This is useful for complex pages like checkout or landing pages built with heavy scripts, while the rest of the site keeps the benefit.
Is Remove Unused CSS better than Load CSS asynchronously?
It usually cuts more CSS weight, which often helps speed scores more. It also carries more risk of missing styles. If it keeps breaking layouts on your theme, the asynchronous option is a safer middle ground.
Sources
- Remove Unused CSS WP Rocket
- Troubleshoot used CSS generation issues WP Rocket
- Troubleshoot Remove Unused CSS display issues WP Rocket
- Cron WordPress Developer Resources
- WP Crontrol WordPress.org
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.
Thanks — we review requests within 3 business days.
Related guides
About the editors
Researched from the primary sources listed above and checked against our editorial rules before publishing.


