Skip to content

Instantly share code, notes, and snippets.

@bi0xid
Created August 19, 2014 15:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bi0xid/e6118ef43f3290f4ce89 to your computer and use it in GitHub Desktop.
Save bi0xid/e6118ef43f3290f4ce89 to your computer and use it in GitHub Desktop.
Add mimetype
<?php
add_filter('upload_mimes', 'custom_upload_mimes');
function custom_upload_mimes ( $existing_mimes = array() ) {
// add your extension to the array
$existing_mimes['patch'] = 'text/plain';
$existing_mimes['diff'] = 'text/plain';
$existing_mimes['po'] = 'text/plain';
$existing_mimes['conf'] = 'text/plain';
$existing_mimes['mo'] = 'text/plain';
$existing_mimes['rtf'] = 'text/rtf';
$existing_mimes['rtfd'] = 'text/rtfd';
$existing_mimes['xml'] = 'text/xml';
$existing_mimes['ai'] = 'application/illustrator';
$existing_mimes['zip'] = 'application/zip';
$existing_mimes['psd'] = 'image/psd';
$existing_mimes['fh11'] = 'application/x-freehand';
$existing_mimes['xls'] = 'application/vnd.ms-excel';
$existing_mimes['xlsx'] = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
$existing_mimes['pages'] = 'application/x-iwork-pages-sffpages';
return $existing_mimes;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment