Skip to content

Instantly share code, notes, and snippets.

@melvinstanly
Created December 3, 2018 07:54
Show Gist options
  • Select an option

  • Save melvinstanly/7fea23e361754d9c0e8bc983679bd157 to your computer and use it in GitHub Desktop.

Select an option

Save melvinstanly/7fea23e361754d9c0e8bc983679bd157 to your computer and use it in GitHub Desktop.
wordpress file upload
//How to fix “this file type is not permitted for security reasons” in WordPress
function enable_extended_upload ( $mime_types =array() ) {
// The MIME types listed here will be allowed in the media library.
// You can add as many MIME types as you want.
$mime_types['gz'] = 'application/x-gzip';
$mime_types['zip'] = 'application/zip';
$mime_types['rtf'] = 'application/rtf';
$mime_types['ppt'] = 'application/mspowerpoint';
$mime_types['ps'] = 'application/postscript';
$mime_types['ai'] = 'application/postscript';
$mime_types['flv'] = 'video/x-flv';
// If you want to forbid specific file types which are otherwise allowed,
// specify them here. You can add as many as possible.
unset( $mime_types['exe'] );
unset( $mime_types['bin'] );
return $mime_types;
}
add_filter('upload_mimes', 'enable_extended_upload');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment