Skip to content

Instantly share code, notes, and snippets.

@avillegasn
Created September 29, 2016 07:18
  • Star 4 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save avillegasn/9d2328c06dfad61c9891731f64d3b97c to your computer and use it in GitHub Desktop.
How to allow uploading additional file extensions in WordPress
<?php
add_filter( 'upload_mimes', 'my_myme_types', 1, 1 );
function my_myme_types( $mime_types ) {
$mime_types['svg'] = 'image/svg+xml'; // Adding .svg extension
$mime_types['json'] = 'application/json'; // Adding .json extension
unset( $mime_types['xls'] ); // Remove .xls extension
unset( $mime_types['xlsx'] ); // Remove .xlsx extension
return $mime_types;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment