Skip to content

Instantly share code, notes, and snippets.

@sdelamo
Last active August 29, 2015 14:20
Show Gist options
  • Save sdelamo/f2bf87eee80af165974a to your computer and use it in GitHub Desktop.
Save sdelamo/f2bf87eee80af165974a to your computer and use it in GitHub Desktop.
Add Forbidden Mime Types to Wordpress
<?php
function custom_upload_mimes ( $existing_mimes = array() ) {
// add your extension to the array
$existing_mimes['gpx'] = 'application/application/gpx+xml';
$existing_mimes['kml'] = 'application/vnd.google-earth.kml+xml';
// or: $existing_mimes['ppt|pot|pps'] = 'application/vnd.ms-powerpoint';
// to add multiple extensions for the same mime type
// add as many as you like
// removing existing file types
//unset( $existing_mimes['exe'] );
// add as many as you like
// and return the new full result
return $existing_mimes;
}
add_filter('upload_mimes', 'custom_upload_mimes');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment