How to deliver the WebP's generated with ShortPixel with the LiteSpeed Cache plugin

Now the LiteSpeed Cache plugin is supported for delivering WebP too! For this you need to do two things:

1. Add this constant in your "wp-config.php" file. Please do so before optimizing your images.

define('SHORTPIXEL_USE_DOUBLE_WEBP_EXTENSION', true);

The constant will make ShortPixel Image Optimizer to generate WebP files with a double extension ("xxxxx.jpg.webp" or "xxxxx.png.webp"), which is required by LiteSpeed Cache.

If you already had optimized images with ShortPixel, you will need to bulk restore your images and then run the bulk optimization again. In this article there's more information about this. Another solution, in case you already have WebP files but with a single extension, is to rename your "image.webp" files, like it's described in this other article.

2. Go to the menu LiteSpeed Cache > Image Optimisation:

3. Click on the tab "Image Optimization Settings":

3. Activate the "Image WebP Replacement" option:

4. Do not activate LiteSpeed’s option to generate the WebP files – ShortPixel will generate them when optimizing the images.

5. Do not activate the option "Deliver the WebP versions of the images in the front-end" that you will find in Settings > ShortPixel > Advanced > WebP Images. Remember that now LiteSpeed is the responsible for the delivery of WebP, not ShortPixel.

Still need help? Contact Us Contact Us