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