I want to create a custom WordPress plugin that converts all images on a WordPress site into WebP format and replaces the original images in the database with the corresponding WebP images.
I have tried the code, which successfully converts images to WebP format. However, I am unable to view these WebP images in the WordPress media folder, and the MIME type of the images is not changing to ‘image/webp’ format. Additionally, the WebP images are not being set in posts again.
1