Title: WebP Image replacement
Last modified: May 15, 2023

---

# WebP Image replacement

 *  Resolved [fotov60](https://wordpress.org/support/users/fotov60/)
 * (@fotov60)
 * [3 years ago](https://wordpress.org/support/topic/webp-image-replacement/)
 * Hello everyone, I have configured Litespeed with the Image WebP replacement option
   enabled and I have used image conversion to webp, but I have several doubts.
 * 1. – Does this function detect whether the browser is compatible with the webp
   format or not and show the image in the correct format that it can recognize?
 * 2. – Does it apply to all images, including those that make up the active theme,
   or only those published within the published entries?
 *  I attach screenshots of how I have it configured in case it is helpful.
 * ![](https://i0.wp.com/i.ibb.co/Gd4MNVq/Screenshot-20230513-222443-Chrome.jpg?
   ssl=1)
 * ![](https://i0.wp.com/i.ibb.co/Qd65RTV/Screenshot-20230513-222354-Chrome.jpg?
   ssl=1)
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fwebp-image-replacement%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 15 replies - 1 through 15 (of 39 total)

1 [2](https://wordpress.org/support/topic/webp-image-replacement/page/2/?output_format=md)
[3](https://wordpress.org/support/topic/webp-image-replacement/page/3/?output_format=md)
[→](https://wordpress.org/support/topic/webp-image-replacement/page/2/?output_format=md)

 *  [serpentdriver](https://wordpress.org/support/users/serpentdriver/)
 * (@serpentdriver)
 * [3 years ago](https://wordpress.org/support/topic/webp-image-replacement/#post-16738253)
 * > Does this function detect whether the browser is compatible with the webp format
   > or not and show the image in the correct format that it can recognize?
 * Yes, but this detection is a bit faulty, but works in most cases.
 * > 2. – Does it apply to all images, including those that make up the active theme,
   > or only those published within the published entries?
 * The replace function applies to all images in HTML Output. The filter searches
   for `<img>` tag in HTML code and replaces .jpg to .jpg.webp or .png to .png.webp
   or any other supported media type if the browser supports webp. Otherwise the
   original image is used.
 * Does this answer your Questions?
    -  This reply was modified 3 years ago by [serpentdriver](https://wordpress.org/support/users/serpentdriver/).
    -  This reply was modified 3 years ago by [serpentdriver](https://wordpress.org/support/users/serpentdriver/).
 *  Thread Starter [fotov60](https://wordpress.org/support/users/fotov60/)
 * (@fotov60)
 * [3 years ago](https://wordpress.org/support/topic/webp-image-replacement/#post-16738474)
 * Not entirely. When I run PageSpeed Insights, I get the message “Serve images 
   in next-gen formats” with some images from the WordPress theme. Does this mean
   that it is not working properly by replacing them for Insights or for all cases
   in general? When I inspect with Google Chrome, I can’t find the webp version 
   of those images. I am attaching a screenshot of the Insights notice so you can
   identify which images I am referring to.
 * ![](https://i0.wp.com/i.ibb.co/ym2y1Mb/Screenshot-20230515-141152-Chrome.jpg?
   resize=333%2C1058&ssl=1)
 *  [serpentdriver](https://wordpress.org/support/users/serpentdriver/)
 * (@serpentdriver)
 * [3 years ago](https://wordpress.org/support/topic/webp-image-replacement/#post-16738506)
 * > Not entirely. When I run PageSpeed Insights, I get the message “Serve images
   > in next-gen formats” with some images from the WordPress theme. Does this mean
   > that it is not working properly by replacing them for Insights or for all cases
   > in general?
 * This can mean that not all images have been converted in webp format yet, so 
   before you make a new test verify if all images have been converted. You can 
   see the status on dashboard of the cache plugin.
 *  Thread Starter [fotov60](https://wordpress.org/support/users/fotov60/)
 * (@fotov60)
 * [3 years ago](https://wordpress.org/support/topic/webp-image-replacement/#post-16738673)
 * As you can see in my first message, I have posted a screenshot in which the plugin
   tells me that it has converted all the images. The only thing I can think of 
   is that either Litespeed does not convert the images of the theme, or it is not
   able to serve them instead of the originals. In case this option is intended 
   to have this function, can you confirm to me that it does?
 *  [serpentdriver](https://wordpress.org/support/users/serpentdriver/)
 * (@serpentdriver)
 * [3 years ago](https://wordpress.org/support/topic/webp-image-replacement/#post-16738689)
 * There are cases where no webp images are delivered. This includes that if the
   original image is smaller than the webp version, then the original image will
   be used. If a browser does not support webp images, then the original image will
   also be used. This affects the Safari browser on iphone if its version is less
   than or equal to 13.
 *  [serpentdriver](https://wordpress.org/support/users/serpentdriver/)
 * (@serpentdriver)
 * [3 years ago](https://wordpress.org/support/topic/webp-image-replacement/#post-16738716)
 * Read also this:
 * [https://docs.litespeedtech.com/lscache/lscwp/ts-media/#webp-not-loading](https://docs.litespeedtech.com/lscache/lscwp/ts-media/#webp-not-loading)
 * [https://docs.litespeedtech.com/lscache/lscwp/ts-media/#some-webp-load-some-do-not](https://docs.litespeedtech.com/lscache/lscwp/ts-media/#some-webp-load-some-do-not)
 * [https://docs.litespeedtech.com/lscache/lscwp/ts-media/#webp-images-not-generated](https://docs.litespeedtech.com/lscache/lscwp/ts-media/#webp-images-not-generated)
    -  This reply was modified 3 years ago by [serpentdriver](https://wordpress.org/support/users/serpentdriver/).
 *  Thread Starter [fotov60](https://wordpress.org/support/users/fotov60/)
 * (@fotov60)
 * [3 years ago](https://wordpress.org/support/topic/webp-image-replacement/#post-16738848)
 * Reading what you have sent me, I have seen the following:
 * “The plugin can only perform WebP replacement on the HTML <img> tag. If the image
   is loaded via CSS, JS, or some other means, LSCache may not be able to correctly
   insert the WebP file.”
 * If I’m not mistaken, the images of the theme are formatted via CSS, which would
   fall into the category that this paragraph mentions as probably not loadable.
 * Thinking about it, would it be a good and viable option to use Litespeed together
   with WebP Express, which mentions that it does convert theme images? In its FAQ,
   it talks about creating two versions of each cached page, but I don’t quite understand
   it. If it is possible to do it by combining both plugins or if it requires some
   more complicated configuration. PS: WebP have the problem that doesnt convert
   gif archives
 * > **I am on a Litespeed server**
   > You do not have to do anything special for it to work on a Litespeed server.
   > You should be able to use WebP Express in any operation mode. For best performance,
   > I however recommend that use the _LiteSpeed Cache_ plugin for page caching.
   > LiteSpeed Cache can be set up to maintain separate page caches for browsers
   > that supports webp and browsers that don’t. Through this functionality it is
   > possible to use «Alter HTML» with the option «Replace image URLs» and «Only
   > do the replacements in webp enabled browsers» mode.
   > The setup was kindly shared and explained in detail by [@ribeiroeder](https://github.com/ribeiroeder)
   > [here](https://github.com/rosell-dk/webp-express/issues/433) [https://github.com/rosell-dk/webp-express/issues/433](https://github.com/rosell-dk/webp-express/issues/433)
 *  [serpentdriver](https://wordpress.org/support/users/serpentdriver/)
 * (@serpentdriver)
 * [3 years ago](https://wordpress.org/support/topic/webp-image-replacement/#post-16738956)
 * Formatting using CSS is irrelevant and therefore has no influence on whether 
   webp images are displayed. However, the LiteSpeed cache plugin requires the correct
   file extension, because the webp replacement in the HTML code changes the file
   extension from e.g. image.jpg to image.jpg.webp. If a plugin for providing webp
   images only changes the MIME type via .htaccess, then this plugin is incompatible
   with the webp replacement function of the LiteSpeed cache plugin.
 * In order for a plugin from a 3rd party provider to work together successfully,
   it must first be ensured that it has a corresponding filter function that works
   in the same way as the filter of the cache plugin. In addition, this plugin must
   also be able to change the file extension in the HTML code. And finally, the 
   correct cache vary must also be able to be set in the .htaccess. According to
   my findings, the WebP Express plugin does not meet these requirements, which 
   is also the reason for the problems. You should therefore only use the webp replacement
   function of the LiteSPeed cache plugin. Any other support when using another 
   plugin for webp use cannot be guaranteed.
 *  Thread Starter [fotov60](https://wordpress.org/support/users/fotov60/)
 * (@fotov60)
 * [3 years ago](https://wordpress.org/support/topic/webp-image-replacement/#post-16739015)
 * Currently, I am only using Litespeed. The WebP Express option is just an alternative
   that was suggested to me when I didn’t get the desired results. If you could 
   visit my website [http://www.fotov60.com](http://www.fotov60.com) and tell me
   the formats in which the images appear to you, I would appreciate it. That way,
   I could check if the Litespeed replacement function is working or not.
 * Taking a look at the screenshots from my first message, is the function configured
   correctly?
 *  [serpentdriver](https://wordpress.org/support/users/serpentdriver/)
 * (@serpentdriver)
 * [3 years ago](https://wordpress.org/support/topic/webp-image-replacement/#post-16739053)
 * The LiteSpeed webp replacement function works as expected. However, you must 
   not expect that another plugin that has the designation “webp” in the plugin 
   name is automatically compatible with the LiteSpeed cache plugin. In this specific
   case, this does not seem to be the case, so I can only recommend that you only
   use the webp replacement function and no other plugin for webp. In addition, 
   it is difficult or impossible to provide support when using several plugins.
 *  Thread Starter [fotov60](https://wordpress.org/support/users/fotov60/)
 * (@fotov60)
 * [3 years ago](https://wordpress.org/support/topic/webp-image-replacement/#post-16739073)
 * [@serpentdriver](https://wordpress.org/support/users/serpentdriver/) I insist
   that I am not using any other plugin at the same time. I only mentioned it as
   an option. Litespeed is the only plugin that is attempting to perform that function
   on my website, which is why I come here seeking help since I am not getting the
   expected results.
 *  [serpentdriver](https://wordpress.org/support/users/serpentdriver/)
 * (@serpentdriver)
 * [3 years ago](https://wordpress.org/support/topic/webp-image-replacement/#post-16739111)
 * Even the imaginary thought of using another plugin as an option is out of the
   question. I can only tell you that the webp replacement of the LiteSpeed cache
   plugin works without any problems. Otherwise, other users would have complained
   about a problem with it several times. If it doesn’t work for you, there must
   be reasons, because a problem doesn’t arise without a reason. A not uncommon 
   problem is that plugin programmers do not pay attention to the fact that not 
   all files and changes are completely removed when deactivating or uninstalling
   a plugin. This is the typical problem with 9 out of 10 plugins and therefore 
   regularly causes conflicts and problems. This circumstance makes it difficult
   to find out the cause of the problems in problem cases like yours.
 *  Thread Starter [fotov60](https://wordpress.org/support/users/fotov60/)
 * (@fotov60)
 * [3 years ago](https://wordpress.org/support/topic/webp-image-replacement/#post-16739359)
 * Why do you mention problem cases like mine? I haven’t used any other plugin with
   that function, so how could an uninstalled plugin that I haven’t used cause a
   conflict?In my message, I asked you if you could review the screenshots to see
   how I have it configured and if you could visit the website to check what format
   appears to you, but you only mentioned that the webp replacement of the LiteSpeed
   cache plugin works without problems. Could you do that so we can detect where
   the problem is?
 *  Thread Starter [fotov60](https://wordpress.org/support/users/fotov60/)
 * (@fotov60)
 * [3 years ago](https://wordpress.org/support/topic/webp-image-replacement/#post-16739943)
 * Well, I think I have found the reason why it may not be working. For example,
   the sidebar is called (if I’m not mistaken) by this code
 *     ```wp-block-code
        <div id="container"> <div id="sidebar" role="complementary">
       ```
   
 *  which refers to a file in a CSS and finally leads to this file [https://www.fotov60.com/wp-content/themes/greyzed/images/sidebar-bg.jpg](https://www.fotov60.com/wp-content/themes/greyzed/images/sidebar-bg.jpg).
   And by going through all this, I imagine that the function of Litespeed is not
   able to replace it. Could I be right?
 *  [serpentdriver](https://wordpress.org/support/users/serpentdriver/)
 * (@serpentdriver)
 * [3 years ago](https://wordpress.org/support/topic/webp-image-replacement/#post-16740573)
 * You thought in the wrong direction, but indirectly gave a hint. The images in
   the sidebar are loaded via Javascript. If images are loaded like this, no replacement
   and therefore no webp images can be loaded. However, your other images will load
   correctly, i.e. *.jpg.webp. Use your browser’s developer console to see this.
   So I see no problem with you. The webp images are loaded correctly and all the
   excitement was in vain.

Viewing 15 replies - 1 through 15 (of 39 total)

1 [2](https://wordpress.org/support/topic/webp-image-replacement/page/2/?output_format=md)
[3](https://wordpress.org/support/topic/webp-image-replacement/page/3/?output_format=md)
[→](https://wordpress.org/support/topic/webp-image-replacement/page/2/?output_format=md)

The topic ‘WebP Image replacement’ is closed to new replies.

 * ![](https://ps.w.org/litespeed-cache/assets/icon-256x256.png?rev=2554181)
 * [LiteSpeed Cache](https://wordpress.org/plugins/litespeed-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/litespeed-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/litespeed-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/litespeed-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/litespeed-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/litespeed-cache/reviews/)

 * 39 replies
 * 4 participants
 * Last reply from: [fotov60](https://wordpress.org/support/users/fotov60/)
 * Last activity: [3 years ago](https://wordpress.org/support/topic/webp-image-replacement/page/3/#post-16744284)
 * Status: resolved