WebP and AVIF - Exclude some site parts from the picture tag replacement
If you are delivering WebP or AVIF files using ShortPixel using the <PICTURE> tag syntax method, you will notice that there is no setting to exclude images from having their tags replaced. That would be useful if you'd like to serve a specific file in its original format.
However, there are some workarounds for that:
- If the images that appear in a section of the site (WooCommerce galleries for example) have a particular name convention (let's say they all start with
myWoo_), you could use the Exclude patterns setting located on Settings > ShortPixel > Advanced. Following the previous example, you would have to input
name:myWoo_into that settings field. The downside is that these excluded images won't be optimized at all.
- Just optimize the specific images you want in original format with the WebP setting off (Settings > ShortPixel > Advanced > Also create WebP versions of the images). This will deactivate the generation of WebP and will make the plugin not serve the WebP images. Bear in mind that if you already optimized those images with the WebP setting on, you should first restore them and then reoptimize them with the WebP setting off.
- A third option, especially useful if you don't want to spend credits re-optimizing your images with the WebP setting off, would be to delete the .webp counterparts of the images you want from your server, using an FTP client or a file manager. This way, ShortPixel will see there is no .webp and will serve the JPG/PNG instead.