Skip to content

Instantly share code, notes, and snippets.

@rotisoft
Last active December 1, 2021 10:52
Show Gist options
  • Save rotisoft/7737cba6b547fc8a2f629c81dd528eef to your computer and use it in GitHub Desktop.
Save rotisoft/7737cba6b547fc8a2f629c81dd528eef 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 approve_mime_types($mime_types){
$mime_types['rar'] = 'application/x-rar-compressed'; // Approve .rar file upload
$mime_types['bmp'] = 'image/bmp'; // Approve .bmp image upload
$mime_types['svg'] = 'image/svg+xml'; // Approve .svg image upload
$mime_types['otf'] = 'application/x-font-otf'; // Approve .otf font upload
$mime_types['ttf'] = 'application/x-font-ttf'; // Approve .ttf font upload
$mime_types['woff'] = 'application/x-font-woff'; // Approve .woff font upload
return $mime_types;
}
add_filter('upload_mimes', 'approve_mime_types', 1, 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment