WP Rocket Delay JS Exclusions - Keep Menus, Sliders and Forms Working (2026)

Delay JavaScript execution is WP Rocket's most powerful JavaScript feature, and occasionally it delays a script your page needs right away. The fix is almost always an exclusion, not switching the feature off.

How Delay JavaScript Works

Delay JavaScript execution holds back JavaScript files and inline scripts until the visitor interacts with the page: moving the mouse, touching the screen, scrolling or pressing a key. It's like lazy loading, but for scripts.

That keeps analytics, ads, chat widgets and most plugin scripts out of the initial load, which is why it improves Total Blocking Time, INP and the "Reduce unused JavaScript" warning so much. The flip side is that anything visible in the first screen that depends on JavaScript may not work, or may look unfinished, until that first interaction.

Common Symptoms

Illustration for Common Symptoms on the WP Rocket Delay JS Exclusions page, showing a code diagram

These are the problems that usually point to Delay JavaScript.

Symptoms and their usual cause
SymptomUsual Cause
A preloader or spinner keeps spinning until you move the mouseThe theme's preloader script is delayed
A slider shows nothing, or all slides stacked, until interactionThe slider script is delayed
The mobile menu doesn't open on the first tapThe menu script is delayed and only loads on that tap
A form, captcha or cookie banner appears lateTheir scripts wait for interaction
Elements animate in only after scrollingAnimation scripts from the theme or builder are delayed
Analytics shows fewer sessionsVisitors who leave without interacting never load the tracking script

Most of these are visual or functional problems in the first screen. Below-the-fold elements usually work fine, because visitors scroll before reaching them, which triggers the delayed scripts.

Step 1: Confirm Delay JavaScript Is the Cause

Before adding exclusions, make sure you're fixing the right feature. WP Rocket's own troubleshooting advice is to isolate it.

  1. Disable other file optimizations

    In Page Optimization's JavaScript & CSS settings, turn off everything except Delay JavaScript execution: minification, Remove Unused CSS and Load JavaScript deferred.

  2. Clear the cache and test

    Load the page in a private window. If the problem is still there, Delay JavaScript is involved.

  3. Disable Delay JavaScript too

    If the problem disappears, you've confirmed the feature.

  4. Re-enable your other settings

    Turn the other optimizations back on and keep troubleshooting with Delay JavaScript as the focus.

If the problem persists with Delay JavaScript off, look at Remove Unused CSS or deferred JavaScript instead. Our broken layout guide covers those.

Step 2: Use One-Click Exclusions

Under Delay JavaScript execution, WP Rocket shows one-click exclusions grouped into analytics and ads, plugins and themes. Ticking a box applies a tested set of exclusions for that plugin, theme or service.

These lists update automatically, so you don't need to look up file names or wait for a plugin update. If the plugin or theme causing trouble is listed, tick it, save, clear the cache and test again. That solves most problems in a minute.

Step 3: Add Manual Exclusions

Illustration for Step 3: Add Manual Exclusions on the WP Rocket Delay JS Exclusions page, showing a code diagram

If your plugin or theme isn't listed, you'll add the script to the Excluded JavaScript Files field yourself. It accepts file URLs or keywords that match part of a file path or inline script.

Find the Script

  1. Open Chrome DevTools

    Load the affected page and open the Network panel, filtered to JS.

  2. Identify candidates

    Look for files whose path matches the broken feature, such as a slider plugin's folder or your theme's main script.

  3. Check the Console

    Errors that appear after interaction, or that mention a missing function, often name the script involved.

  4. Use a keyword

    A distinctive part of the path, like the plugin's folder name, is usually enough.

Remember Dependencies

Scripts often depend on others. If you exclude a slider script that relies on jQuery, jQuery must also run early, or the slider will throw an error. Exclude the dependency too, such as the jQuery file, and any small inline script the plugin uses to pass settings.

That's why one-click exclusions are easier: they already include the dependencies. When excluding manually, add the main script first, test, then add dependencies one at a time until it works.

Common Exclusion Examples

These illustrate the pattern. Exact file names vary by version, so confirm in your Network panel before copying.

Typical manual exclusions by feature
Feature That BreaksWhat to Try Excluding
Mobile menuYour theme's navigation or main script, plus jQuery if the theme uses it
Slider or carousel in the first screenThe slider plugin's main script and its dependency
Cookie consent bannerThe consent plugin's script, so the banner appears immediately
Theme preloaderBetter fixed by disabling the preloader in your theme settings
Form validation or captcha above the foldThe form plugin's script, or the captcha service's script

Step 4: Keep the Speed Gain

Every exclusion is a script that loads early again, which gives back some of the speed improvement. WP Rocket's documentation notes that if "Reduce unused JavaScript" still appears in PageSpeed Insights, you may be excluding too much.

Exclude only what's needed for the first screen to work. If a feature only matters further down the page, leave it delayed, since the visitor's scroll will trigger it before they reach it.

Some features are better fixed at the source. A theme preloader that hides the page until scripts load is a good example: disabling the preloader in your theme settings is both faster and simpler than excluding its scripts. Similarly, if a hero slider is causing trouble, replacing it with a static hero image often improves LCP too.

Exclusions on Specific Pages Only

Sometimes a script needs to run early on one page but not elsewhere, for example a calculator on a single landing page. Excluding it globally would slow every page.

WP Rocket's documentation provides a small helper plugin for excluding scripts from Delay JavaScript only on specific URLs. It takes a few minutes to configure and keeps the rest of your site fully optimized.

Delay JavaScript vs Load JavaScript Deferred

Illustration for Delay JavaScript vs Load JavaScript Deferred on the WP Rocket Delay JS Exclusions page, showing a compare diagram

The two settings sit next to each other in WP Rocket and are easy to confuse. Load JavaScript deferred keeps scripts loading early but moves their execution until after the HTML is parsed, in order. Delay JavaScript execution doesn't load the scripts at all until the visitor interacts.

You can use both together, and most sites should. Deferring handles the scripts that must run on load without blocking rendering. Delaying handles everything that can wait. When you exclude a script from Delay JavaScript, it still benefits from defer, so you don't lose everything by excluding it.

Page Builders and Delay JavaScript

Elementor, Divi and other builders use JavaScript for animations, sticky headers, tabs, carousels and popups. Elements that animate into view in the first screen are the most common thing to look wrong with Delay JavaScript on.

Check whether WP Rocket's one-click exclusions list your builder, and tick it if so. Then consider whether first-screen entrance animations are worth keeping: removing them often improves both LCP and the first impression. See speeding up Elementor and speeding up Divi.

A Quick Testing Checklist

After adding or changing exclusions, run through these checks in a private window, on desktop and on a phone.

What About Analytics?

Delaying analytics scripts means visitors who leave without any interaction aren't counted. Some owners accept that trade-off, since those visits are usually bounces. Others exclude their analytics script to keep session counts complete.

Either choice is reasonable. If accurate session counts matter more to you than a slightly lower blocking time, exclude the analytics script. If performance matters more, leave it delayed and note the change in your reports. See reducing third-party code for the wider trade-offs.

WP Rocket Delay JS Exclusions FAQ

Should I turn off Delay JavaScript if something breaks?

Usually not. Add an exclusion for the script involved instead. Turning the feature off loses the biggest JavaScript performance gain WP Rocket offers.

Why does my page look broken until I move the mouse?

Scripts that build the first screen, such as a slider, preloader or animation, are being delayed until interaction. Exclude those scripts or disable the feature in your theme.

How do I know which file to exclude?

Check the Network panel for scripts related to the broken feature and the Console for errors. A distinctive part of the file path, like the plugin folder name, usually works as the exclusion.

Does excluding scripts hurt performance?

A little, because excluded scripts load early. Keep exclusions to what's needed for the first screen and you'll keep most of the benefit.

Will Delay JavaScript affect my analytics?

Visitors who leave without interacting won't trigger delayed analytics scripts. Exclude your analytics script if complete session counts matter more than the performance gain.