When a mobile menu stops opening, images behave unexpectedly, a form no longer submits or a WooCommerce filter becomes unresponsive, the cause may be connected with how JavaScript is loaded. WP Rocket’s Delay JavaScript Execution can improve optimization coverage, but a delayed script may also be required earlier by a theme, plugin or interactive element. The correct response is not to copy a universal exclusion list. Each site has its own dependencies, URLs and browser errors.
This guide presents a controlled troubleshooting path. First, isolate Delay JavaScript Execution from other File Optimization features. Next, use browser Console errors and the ?nowprocket parameter to compare the optimized and unoptimized page. Finally, apply the smallest tested exclusion and refine it after the affected feature works again.
What Delay JavaScript Execution changes
Delay JavaScript Execution changes when JavaScript runs on the page. A script that would normally execute during page loading may wait until user interaction. This can affect visible behavior as well as functionality, especially when another script expects a dependency to be available earlier. WP Rocket applies the feature to cached or optimized pages, so the behavior should be assessed on the affected cached page rather than only in an isolated development view.
Before investigating individual files, check the broader configuration. WP Rocket documentation states that JavaScript combination should be disabled when using Delay JavaScript Execution because combining files can cause display issues. This does not prove that combination is responsible for a particular problem, but it prevents two optimization changes from being investigated as if they were one.
Visual delay versus a genuine functionality failure
Observe what happens after the page loads and after you interact with it. If an element becomes correct after interaction, the problem may be primarily visual: the required script eventually runs, but the initial presentation is delayed. If the element remains broken after interaction, treat it as a layout or functionality issue that may require an exclusion.
This distinction helps set the right priority. A short visual delay may be acceptable in some situations, while a menu that never opens, a form that cannot submit or a filter that remains unusable requires a dependency investigation. Pre-existing Console errors can interfere with this diagnosis, so record them before drawing conclusions.
Confirm that Delay JavaScript Execution is the cause
Do not begin by excluding several scripts at once. First perform an isolation test. WP Rocket recommends leaving Delay JavaScript Execution enabled while disabling the other File Optimization features. Then disable Delay JavaScript Execution and reload the affected URL. If the problem disappears, the delay feature is a likely cause. This is a controlled indication, not a guarantee that every issue on the page has the same origin.
A repeatable comparison workflow
- Record the original behavior, including the exact page, feature and interaction that fails.
- Create a staging test or backup before changing optimization exclusions on a production site.
- Disable the other File Optimization features while keeping Delay JavaScript Execution enabled for the isolation test.
- Check the browser Console for errors that existed before the optimization change.
- Disable Delay JavaScript Execution, reload the same URL and repeat the exact interaction.
- Compare whether the feature is merely delayed or remains genuinely unusable.
Test carefully if the affected feature involves checkout, login, payments, forms or account actions. Check the original page after every configuration change, and test the relevant interaction on desktop and mobile. Once the comparison points to Delay JavaScript Execution, continue with targeted diagnosis instead of leaving all optimization disabled.
Use Console errors to identify the delayed dependency
Browser Developer Tools can connect a visible failure with a missing JavaScript dependency. Open the affected URL, inspect the Console and look for messages indicating that a function or variable is not defined. Record the exact name from the error. It can provide a useful clue about which file defines or uses the functionality that was delayed.
An undefined name does not automatically identify an entire plugin or theme directory. Treat it as a starting point. Search the loaded resources for the function or variable, then relate the candidate file to the feature that fails. A new error after an exclusion change may reveal another dependency in the execution chain.
From an undefined function to a candidate file
- Copy the function or variable name shown in the Console message.
- Use the browser’s resource or search view to look for that name across loaded files.
- Identify files that define or depend on the missing functionality.
- Form a file-specific or path-specific exclusion candidate.
- Save one change, retest the original feature and record any new Console error.
This method is more reliable than applying a generic list of exclusions. It also keeps the investigation connected to the actual theme, plugins, page URL and interaction on the site.
Use ?nowprocket as an unoptimized comparison
The ?nowprocket parameter provides a same-URL comparison that bypasses WP Rocket’s optimizations. Open the affected URL with this parameter and compare it with the normal cached or optimized version. If the feature works in the bypass version but fails in the optimized version, inspect how the relevant scripts differ between those two cases.
Use the Console error or the affected feature as your search clue. In the unoptimized comparison, search loaded resources for the recorded function, variable or class. This can help show which script is available, loaded differently or executed in a different order. The goal is to identify a likely dependency, not to guess a filename from the name of a plugin.
Compare the affected feature, not only the page source
Keep the investigation focused on the interaction that fails. For a menu, compare whether its related class and script are present and effective. For an image, investigate the behavior connected with lazy loading. For a form, filter or WooCommerce interaction, follow the Console error and the files connected with the missing function.
After saving a targeted exclusion, clear or regenerate the relevant cache and optimization files, then retest both the original URL and the ?nowprocket comparison. The precise cache-clearing procedure can vary by hosting provider or CDN, so verify the result on the affected page rather than assuming that a saved setting has already changed every cached copy.
Find exclusions for menus, images and forms
The right exclusion depends on the broken feature and its dependency chain. WP Rocket documentation does not provide one universal list for every WordPress theme, form plugin, menu system or WooCommerce extension. Use the unoptimized page, Console errors and loaded resources to identify the relevant script.
Map the broken feature to its scripts
- Mobile menus: inspect the menu markup, related class names and scripts on the unoptimized page. Use those clues to locate the file controlling the menu interaction.
- Images: investigate theme or plugin lazy-loading scripts. Consider whether two lazy-loading systems may be competing rather than assuming that every image problem comes from the delay feature.
- Preloaders: if a preloader remains visible, investigate the scripts controlling its completion and removal.
- Forms and filters: use Console errors to find undefined functions or variables, then follow the files that define or depend on them.
- Interactive WooCommerce features: test the complete interaction, not only the initial page display, and connect any error to a specific dependency before excluding it.
Test the affected feature on desktop and mobile, including keyboard and touch interactions where relevant. For checkout, login, payment, form and account actions, verify the complete flow before considering the problem resolved. Do not apply several broad exclusions at once: doing so can restore the feature while hiding the dependency that actually caused the conflict.
Apply targeted exclusions and refine the final configuration
Once a candidate dependency has been identified, begin with the narrowest practical change. WP Rocket documents one-click exclusions for certain plugins, themes or services. Where those do not identify the required script, use the Excluded JavaScript Files field with a specific filename, part of a path, keyword or carefully tested wildcard.
When excluding an external script, use its filename or part of its path rather than the external domain. JavaScript may be hosted locally when minification is enabled, so an exclusion based only on the domain may not match the resource being processed. If the Console indicates a dependency issue involving jQuery and jQuery Migrate, handle the relationship deliberately rather than excluding unrelated files.
A practical exclusion refinement loop
- Save one targeted filename, path or keyword exclusion.
- Clear or regenerate relevant cache and optimization files.
- Retest the original feature on the affected URL and compare it with
?nowprocket. - Check the Console for remaining or new errors.
- If the feature works, remove exclusions one at a time and retest.
- Keep only the smallest file-specific or path-specific rule that restores functionality.
Broad patterns, such as excluding an entire plugin or theme directory, can reduce optimization coverage and may hide the underlying dependency problem. Narrowing the rule after functionality returns preserves more of the intended optimization behavior.
When Safe Mode is useful
Safe Mode can serve as a temporary diagnostic fallback when targeted investigation has not yet identified the dependency. WP Rocket documents that it excludes a broad set of scripts, including scripts under wp-content and wp-includes, jQuery, jQuery Migrate and certain inline scripts. Such broad exclusions can help indicate whether delayed scripts are involved.
However, Safe Mode should not automatically become the permanent configuration. WP Rocket describes the trade-off: broad exclusions can remove much of the expected performance benefit. After confirming the cause, return to the Console, ?nowprocket comparison and loaded-resource investigation, then replace the broad fallback with a targeted exclusion where possible.
The safest troubleshooting path is controlled rather than absolute. Isolate Delay JavaScript Execution, distinguish a visual delay from genuine breakage, inspect Console errors and compare the same URL with ?nowprocket. Then exclude the smallest relevant file or path, regenerate the applicable cache and test the exact menu, image, form, filter or WooCommerce interaction on the devices that matter. Because dependencies differ between themes, plugins and URLs, an exclusion that works on one site should not be copied blindly to another. Explore our WordPress plugins, WooCommerce extensions, themes and membership plans to find the right tools for your website.