Skip to content

Instantly share code, notes, and snippets.

@dougalcampbell
Created September 28, 2012 03:36
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save dougalcampbell/3797807 to your computer and use it in GitHub Desktop.
WordPress snippet: add uploadable file types
/**
* Add uploadable mime types / file extensions
*/
function dc_add_uploadables($arr = array()) {
$new = array(
// Add file extension => mime type mapping here
'keynote|key' => 'application/vnd.apple.keynote',
'numbers' => 'application/vnd.apple.numbers',
'pages' => 'application/vnd.apple.pages'
);
$arr = array_merge($arr, $new);
return $arr;
}
if ( function_exists( 'wp_get_mime_types' ) ) {
// @since WordPress 3.5.0
add_filter('mime_types', 'dc_add_uploadables');
} else {
add_filter('upload_mimes', 'dc_add_uploadables');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment