If you've used EWWW IO's WebP converter, you have probably seen the Alt 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 right in the head element of the page, so that it will start processing images as soon as it can.

This is all fine and dandy, except some hack attempts 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 script as an external file instead of an inline file, simple define the EWWW_IMAGE_OPTIMIZER_WEBP_EXTERNAL_SCRIPT constant in wp-config.php, like so:


Still need help? Contact Us Contact Us