Created
October 6, 2017 18:03
-
-
Save EricBusch/ebd2dd6c48a8803f686d0bcda439c8f7 to your computer and use it in GitHub Desktop.
This adds support for webp when importing webp images into WordPress. [datafeedr]
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 | |
/** | |
* Add support for webp to WordPress. | |
* | |
* @param array $mime_types | |
* | |
* @return array Updated $mime_types array. | |
*/ | |
add_filter( 'mime_types', 'mycode_mime_types', 20 ); | |
function mycode_mime_types( $mime_types ) { | |
if ( isset( $mime_types['webp'] ) ) { | |
return $mime_types; | |
} | |
$mime_types['webp'] = 'image/webp'; | |
return $mime_types; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment