Forked from avillegasn/wordpress-additional-files.php
Created
February 11, 2022 19:38
-
-
Save sumonst21/a86289035af652a434150cd8fd6b8a36 to your computer and use it in GitHub Desktop.
How to allow uploading additional file extensions in WordPress
This file contains hidden or 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