Created
September 29, 2016 07:18
-
-
Save avillegasn/9d2328c06dfad61c9891731f64d3b97c to your computer and use it in GitHub Desktop.
How to allow uploading additional file extensions 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 | |
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