Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Modify mime type in wordpress
<?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
You can’t perform that action at this time.