Last active
January 28, 2021 19:08
-
-
Save kopepasah/7e5b14f772df173e46c0c96918c28c3e to your computer and use it in GitHub Desktop.
Filters the WordPress mime type uploads to allow for JSON files.
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 | |
/** | |
* Allow JSON file uploads to WordPress media library. | |
* | |
* @package WordPress | |
* | |
* @author Justin Kopepasah <justin@kopepasah.com> | |
*/ | |
/** | |
* Filters the uploads mime types to allow JSON files. | |
* | |
* @param array $types Currently allowed types. | |
* | |
* @return array Filtered types. | |
*/ | |
add_filter( | |
'upload_mimes', | |
function( $types ) { | |
return array_merge( $types, [ 'json' => 'text/plain' ] ); | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment