If you upload an image after the plugin is active, the WebP/AVIF images should automatically be served on the frontend. If you have existing images uploaded beforehand, then you’ll need to re-generate them as advised in the readme.
I’ve tried both. In both cases webp/avif files are created on the server but not served on the front end. How can I debug this?
Can you reproduce the issue in a clean install on a local dev environment? Or is it unique to your hosting setup?
Yes, tested on a staging server and locally (LocalWP).
How exactly are the images served?
The plugin rewrites the image URLs on frontend, replacing JPEG image URLs with WebP/AVIF ones (when available). It won’t serve WebP/AVIF when requesting the JPEG image URL directly.
Ok, that’s not happening. How can I debug this issue?
Here is where the filters are added for the images in the content, as well as background images for a couple blocks: https://github.com/WordPress/performance/blob/9e37419cb7b095720dce251a5dd87934e1a5d737/plugins/webp-uploads/hooks.php#L852-L857
You can see that it is filtering wp_content_img_tag which will apply to IMG tags in the content. The webp_uploads_filter_image_tag() function handles the replacement in this case, supplying what is returned by webp_uploads_img_tag_update_mime_type().
A modern image format is inserted for a featured image with this logic: https://github.com/WordPress/performance/blob/9e37419cb7b095720dce251a5dd87934e1a5d737/plugins/webp-uploads/hooks.php#L664-L681
So whether or not the image replacement is working depends on how the theme/plugin is printing an image. Are you not seeing replacement in regular post content? If not, then the above code would give you a place to start debugging.