Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save adamsilverstein/9cf8ba4ebc3838031fc27b45ff20e014 to your computer and use it in GitHub Desktop.
Save adamsilverstein/9cf8ba4ebc3838031fc27b45ff20e014 to your computer and use it in GitHub Desktop.
<?php
// Ensure all network sites include WebP support.
add_filter(
'site_option_upload_filetypes',
function ( $filetypes ) {
$filetypes = explode( ' ', $filetypes );
if ( ! in_array( 'webp', $filetypes, true ) ) {
$filetypes[] = 'webp';
$filetypes = implode( ' ', $filetypes );
}
return $filetypes;
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment