If you've used EWWW IO's WebP converter, you have probably seen the JS WebP Rewriting option. I won't go into too much of the detail on that here, but it essentially parses the entire page, and re-codes your image tags to have WebP variants inserted.

It requires a bit of JavaScript on the front-end, and normally this is included as an inline script in the footer of the page, so that it will start processing images as soon as it can.

This is all fine and dandy, except some hackers will use inline scripts to inject content into your pages. To that end, there are controls like Content Security Policy (CSP) that allow you to specify exactly where JavaScript may be loaded from on your pages. By default, inline scripts are considered "unsafe" by CSP, and so you might be looking to make all your scripts external. There are plenty of hurdles to overcome when trying to get rid of inline scripts in WordPress, but at least you can remove one of them.

If you want to force EWWW IO to load the WebP scripts as external files instead of inline, simply define the EWWW_IMAGE_OPTIMIZER_WEBP_EXTERNAL_SCRIPT constant in wp-config.php, like so:


Still need help? Contact Us Contact Us