How to replace old image with converted webp image in WordPress media library
I have this hook in Wordpress that will convert any uploaded PNGs or JPEGS to WebP images: add_filter( 'wp_handle_upload', 'create_webp' ); function create_webp($file) { if ($file['type'] === "image/png") { // Create and save $img = imagecreatefrompng($file['file']); imagepalettetotruecolor($img); imagealphablending($img, true); imagesavealpha($img,…