Created
September 28, 2012 03:36
-
-
Save dougalcampbell/3797807 to your computer and use it in GitHub Desktop.
WordPress snippet: add uploadable file types
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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