Created
November 13, 2019 14:27
-
-
Save jbma/173d81d8af20fa3351d60a6e14212cc4 to your computer and use it in GitHub Desktop.
WebP Gif
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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