{"id":727,"date":"2024-05-07T11:42:16","date_gmt":"2024-05-07T11:42:16","guid":{"rendered":"https:\/\/kb.shortpixel.com\/docs\/how-to-deliver-the-webps-generated-with-shortpixel-with-the-litespeed-cache-plugin\/"},"modified":"2025-08-27T08:45:36","modified_gmt":"2025-08-27T08:45:36","password":"","slug":"how-to-deliver-the-webps-generated-with-shortpixel-with-the-litespeed-cache-plugin","status":"publish","type":"docs","link":"https:\/\/kb.shortpixel.com\/knowledge-base\/article\/how-to-deliver-the-webps-generated-with-shortpixel-with-the-litespeed-cache-plugin\/","title":{"rendered":"How to deliver the WebP generated by ShortPixel with LiteSpeed Cache"},"content":{"rendered":"\n<div class=\"callout-yellow\">\n<p>If you previously followed the instructions on this page and discover that some or all of your WebP image files are missing, it is likely due to a <a href=\"https:\/\/wordpress.org\/plugins\/litespeed-cache\/#developers\" target=\"_blank\" rel=\"noopener\">change<\/a> the LiteSpeed team introduced in LiteSpeed Cache 5.4. To resolve this, please proceed with the following steps:<\/p>\n<ol>\n<li>Upgrade to the latest version of ShortPixel Image Optimizer (at least 5.3.0).<\/li>\n<li>Add this line to the functions.php file (or via the <a href=\"https:\/\/wordpress.org\/plugins\/code-snippets\" target=\"_blank\" rel=\"noopener\">Code Snippets<\/a> plugin): <code class=\"inline-code\">add_filter('shortpixel\/image\/filecheck', function () { return true; });<\/code><\/li>\n<li><a href=\"https:\/\/shortpixel.com\/knowledge-base\/article\/i-optimized-already-all-the-images-but-then-i-realized-that-i-didnt-select-the-option-to-generate-webp-what-can-i-do\/\" target=\"_self\" rel=\"noopener\">Run again the ShortPixel bulk optimization<\/a> to generate the missing WebP files.<\/li>\n<li>Remove the line from step #2.<\/li>\n<\/ol>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Instructions<\/h2>\n\n\n\n<p>If you want to use LiteSpeed Cache instead of ShortPixel Image Optimizer (SPIO) to deliver the WebP files,\u00a0but still use SPIO to create them, you need to do the following:<\/p>\n\n\n\n<p>1. Add this line to&nbsp;your <code class=\"inline-code\">wp-config.php<\/code> file. Please do this&nbsp;<strong>before <\/strong>you optimize your images.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>define('SHORTPIXEL_USE_DOUBLE_WEBP_EXTENSION', true);<\/code><\/pre>\n\n\n\n<p>This constant makes ShortPixel Image Optimizer to generate WebP files with a double extension (<code class=\"inline-code\">xxxxx.jpg.webp<\/code> or <code class=\"inline-code\">xxxxx.png.webp<\/code>), which is required by LiteSpeed Cache.<\/p>\n\n\n\n<p>If you already optimized images with ShortPixel before adding the constant, you will need to <a href=\"https:\/\/shortpixel.com\/knowledge-base\/article\/can-i-restore-my-images-what-happens-with-the-originals\/\" rel=\"noopener\">bulk restore<\/a> your images, add the previous constant, and then run the bulk optimization again. Another solution in case you already have WebP files with a single extension is to rename your&nbsp;<code class=\"inline-code\">xxxxx.webp<\/code> files,&nbsp;as described <a href=\"https:\/\/shortpixel.com\/knowledge-base\/article\/how-to-rename-my-webp-images-from-single-to-double-extension\/\" rel=\"noopener\">in this other article<\/a>.<\/p>\n\n\n\n<p>2. Go to the <strong>LiteSpeed Cache &gt; Image Optimisation&nbsp;<\/strong>menu:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/kb.shortpixel.com\/wp-content\/uploads\/2025\/08\/file-EbgKKie8fy.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p>3. Click the &#8220;<strong>Image Optimization Settings<\/strong>&#8221; tab:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/kb.shortpixel.com\/wp-content\/uploads\/2025\/08\/file-o5iww70p6y.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p>3. Enable &#8220;<strong>Image WebP Replacement<\/strong>&#8221; and &#8220;<strong>WebP For Extra srcset<\/strong>&#8220;:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/kb.shortpixel.com\/wp-content\/uploads\/2025\/08\/file-vZPJb1bukl.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p>4. <strong>Set the rest of LiteSpeed&#8217;s image optimization settings to OFF<\/strong>.&nbsp;They should be enabled only if you want to optimize your images with LiteSpeed instead of ShortPixel.<\/p>\n\n\n\n<p>5. Go to&nbsp;Settings &gt; ShortPixel &gt; WebP\/AVIF &amp; CDN and disable both &#8220;<strong><strong>Deliver the next generation images using the ShortPixel CDN<\/strong><\/strong>&#8221; and &#8220;<strong>Serve WebP\/AVIF images from locally hosted files (without using a CDN)<\/strong>&#8220;.&nbsp;Remember that LiteSpeed is now responsible for delivering WebP, not ShortPixel.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"509\" src=\"https:\/\/kb.shortpixel.com\/wp-content\/uploads\/2024\/05\/Screenshot-20250305_103125-1024x509.jpg\" alt=\"\" class=\"wp-image-1772\" srcset=\"https:\/\/kb.shortpixel.com\/wp-content\/uploads\/2024\/05\/Screenshot-20250305_103125-1024x509.jpg 1024w, https:\/\/kb.shortpixel.com\/wp-content\/uploads\/2024\/05\/Screenshot-20250305_103125-300x149.jpg 300w, https:\/\/kb.shortpixel.com\/wp-content\/uploads\/2024\/05\/Screenshot-20250305_103125-768x382.jpg 768w, https:\/\/kb.shortpixel.com\/wp-content\/uploads\/2024\/05\/Screenshot-20250305_103125-360x179.jpg 360w, https:\/\/kb.shortpixel.com\/wp-content\/uploads\/2024\/05\/Screenshot-20250305_103125.jpg 1520w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Alternatives<\/h2>\n\n\n\n<p>If you cannot use this method,&nbsp;you should try an alternative solution for WebP image delivery:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use one of the WebP delivery options built into SPIO: <a href=\"https:\/\/shortpixel.com\/knowledge-base\/article\/how-to-serve-webp-files-using-spio\/\" rel=\"noopener\">How to create and serve WebP files using ShortPixel Image Optimizer<\/a><\/li>\n\n\n\n<li>Replace ShortPixel Image Optimizer with <a href=\"https:\/\/wordpress.org\/plugins\/shortpixel-adaptive-images\/\" rel=\"noopener\">ShortPixel Adaptive Images<\/a>.<\/li>\n\n\n\n<li>Use another plugin to deliver the WebP files created by ShortPixel, such as <a href=\"https:\/\/wordpress.org\/plugins\/cache-enabler\/\" rel=\"noopener\">Cache Enabler<\/a> or <a href=\"https:\/\/wp-rocket.me\/\" rel=\"noopener\">WP Rocket<\/a>.<\/li>\n\n\n\n<li>If you have an NGINX server, you can <a href=\"https:\/\/shortpixel.com\/knowledge-base\/article\/configure-nginx-to-transparently-serve-webp-files-when-supported\/\" rel=\"noopener\">configure NGINX to transparently serve WebP files when supported<\/a>.<\/li>\n<\/ul>\n\n\n\n<div class=\"callout\">\nIf you can&#8217;t or don&#8217;t want to use any of the alternative methods, and you still want to use LiteSpeed Cache to deliver your WebP files, please contact the LiteSpeed Cache support team.\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>If you previously followed the instructions on this page and discover that some or all of your WebP image files are missing, it is likely due to a change the LiteSpeed team introduced in LiteSpeed Cache 5.4. To resolve this, please proceed with the following steps: Upgrade to the latest version of ShortPixel Image Optimizer [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"doc_category":[37],"glossaries":[],"doc_tag":[],"class_list":["post-727","docs","type-docs","status-publish","hentry","doc_category-shortpixel-image-optimizer"],"blocksy_meta":[],"year_month":"2026-04","word_count":453,"total_views":"3926","reactions":{"happy":"0","normal":"0","sad":"0"},"author_info":{"name":"admin","author_nicename":"admin_mdli53m5","author_url":"https:\/\/kb.shortpixel.com\/author\/admin_mdli53m5\/"},"doc_category_info":[{"term_name":"ShortPixel Image Optimizer","term_url":"https:\/\/kb.shortpixel.com\/knowledge-base\/category\/shortpixel-image-optimizer\/"}],"doc_tag_info":[],"knowledge_base_info":[],"knowledge_base_slug":[],"_links":{"self":[{"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/docs\/727","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/comments?post=727"}],"version-history":[{"count":3,"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/docs\/727\/revisions"}],"predecessor-version":[{"id":2611,"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/docs\/727\/revisions\/2611"}],"wp:attachment":[{"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/media?parent=727"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/doc_category?post=727"},{"taxonomy":"glossaries","embeddable":true,"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/glossaries?post=727"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/kb.shortpixel.com\/wp-json\/wp\/v2\/doc_tag?post=727"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}