Excluding External JS from Concatenation
For example, if you would notice an issue with a file like this:
…the part of the URL that you would need to exclude from WP Rocket’s file optimization would look like this:
Similarly you would trim any other external file URL to its (sub-)domain part only.
📥 Download (.zip): WP Rocket | External Script Handler
Developers: You can find the code for this plugin on GitHub.
Heads up! You may have to edit the helper plugin before use!
Make sure the URL part you want to exclude is already listed in the code. If it’s not, add it as follows:
In order to add a custom script entry to the plugin, you would insert a line similar to the following one just before the
return $external_js_hosts; statement:
$external_js_hosts = 'example.com';
Also, take note of the hosts that are already included in the plugin. Maybe you don’t even have to add yours again, because it is already there?