Last active
September 30, 2022 19:59
-
-
Save adamsilverstein/89c2d0c2128422c93e4fa6d8d0489be0 to your computer and use it in GitHub Desktop.
Output WebP mini plugin
This file contains hidden or 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 | |
/** | |
* Outout WebP sub size images. | |
* | |
* @wordpress-plugin | |
* Plugin Name: WebP-only. | |
* Description: Output WebP sub size images. | |
* Plugin URI: | |
* Version: 1.0.0 | |
* Author: Adam Silverstein, Google | |
* License: Apache License 2.0 | |
* License URI: https://www.apache.org/licenses/LICENSE-2.0 | |
*/ | |
function filter_image_editor_output_format( $mappings ){ | |
$mappings[ 'image/jpeg' ] = 'image/webp'; | |
return $mappings; | |
} | |
add_filter( 'image_editor_output_format', 'filter_image_editor_output_format' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment