Exclude files from Load JavaScript Deferred

In some cases, the option Load JavaScript deferred (in  File Optimization →  JavaScript Files) may conflict with a specific file.

If this option causes any problems, you may need to exclude a file from the process. 

You can use the field in the plugin settings to exclude files:

 Exclusions may be done by using any of the following:

  • Full file URLs (with query strings removed)
  • Keywords from the file URL
  • Wildcards

Heads up!

Certain patterns of exclusions cannot be handled and are automatically removed.

If you add them, you should see a notice with the "WP Rocket: The following patterns are invalid and have been removed" message.

Please see more in our Invalid patterns of exclusions article.


Exclude an externally hosted file

<script src="//maps.googleapis.com/maps/api/js?key=AIzaSyBusRuOn8uzsREWbwi-KCU4puf0me2aj3A&libraries=places" type="text/javascript"> </script>

You could simply use the domain:


This applies to external files that weren't minified by WP Rocket, and thus, kept their original external domain name.

Exclude a single file

To exclude this file:


Use the following:


Exclude a group of files

To exclude all files from a specific plugin folder, you could use a wildcard:


Use the following:


Exclude a minified file

To exclude a file which is also minified, the exclusion has to be based on the minified file URL. So choose a part of the URL (excluding the domain) which is unchanged by minification.

To exclude this file:

Use the following:


Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.