Skip to content

Instantly share code, notes, and snippets.

@jbma
Created November 13, 2019 14:27
Show Gist options
  • Save jbma/173d81d8af20fa3351d60a6e14212cc4 to your computer and use it in GitHub Desktop.
Save jbma/173d81d8af20fa3351d60a6e14212cc4 to your computer and use it in GitHub Desktop.
WebP Gif
<?php
function no_webp_for_gif( $response, $process, $file, $thumb_size, $optimization_level, $webp, $is_disabled ) {
if ( ! $webp || $is_disabled || is_wp_error( $response ) ) {
return $response;
}
if ( 'image/gif' !== $file->get_mime_type() ) {
return $response;
}
return new \WP_Error( 'no_webp_for_gif', __( 'Webp version of gif is disabled by filter.' ) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment