Exclude files from Defer JS

In rare cases the option “Load JS files deferred” (Static Files → Render-blocking CSS/JS) could conflict with a specific file.

If this option causes any problems, you may need to exclude a file from the process. You can do that by downloading, installing, and editing the following small helper plugin.

📥  Download (.zip): WP Rocket | Exclude Files from Defer JS

Developers: You can find the code for this plugin on GitHub.

Heads up! You must edit the helper plugin before use!
The line beginning $excluded_files[] should reflect the path of the file you want to exclude.

Tips to make this work

Remove query string

Remove any query string following the .js extension. For example, to exclude:




Remove domain name from external file URIs

For external JS files (i.e. those not hosted on your domain), remove the domain name. For example, to exclude: