Created
August 22, 2016 06:20
-
-
Save mostafasoufi/3d8cfec732bb4d2f02f8b11eddfacbec to your computer and use it in GitHub Desktop.
Modify mime type in wordpress
This file contains 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
<?php | |
/** | |
* Modify wordpress mime types | |
* @param array $existing_mimes current mimes | |
*/ | |
function modify_mime_type($existing_mimes){ | |
return array_merge($existing_mimes, array( | |
'7z' => 'application/x-7z-compressed', | |
'rar' => 'package/rar', | |
'tar' => 'package/x-tar', | |
'tgz' => 'application/x-tar-gz', | |
'apk' => 'application/vnd.android.package-archive', | |
'pkpass' => 'application/vnd.apple.pkpass', | |
'zip' => 'package/zip', | |
'gz|gzip' => 'package/x-gzip') | |
); | |
return $existing_mimes; | |
} | |
// Add new mime type | |
add_filter( 'upload_mimes', 'modify_mime_type' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment