Skip to content

Instantly share code, notes, and snippets.

@rotisoft
Last active December 1, 2021 11:06
Show Gist options
  • Save rotisoft/180cdcaee0876f4624dbbd50ca3b6fab to your computer and use it in GitHub Desktop.
Save rotisoft/180cdcaee0876f4624dbbd50ca3b6fab to your computer and use it in GitHub Desktop.
/**
* Add that code to your theme functions.php file. Choose or modify which file/mime type need and delete the others.
* Replace the file type. More info: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
* Gist by Tamas Rottenbacher
* Source: https://wpsmackdown.com/add-remove-filetypes-wordpress-media-library/
*/
function disable_mime_types($mime_types){
unset($mime_types['bmp']); // Disable .bmp file upload
unset($mime_types['tiff']); // Disable .tiff file upload
return $mime_types;
}
add_filter('upload_mimes', 'disable_mime_types', 1, 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment