Last active
January 9, 2023 20:50
-
-
Save tribulant/a33b9c56ececec572cdaa1298d2a056c to your computer and use it in GitHub Desktop.
WordPress upload_mimes filter hook example
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
// Add this to the functions.php file of your WordPress theme | |
// It filters the mime types using the upload_mimes filter hook | |
// Add as many keys/values to the $mimes Array as needed | |
function my_custom_upload_mimes($mimes = array()) { | |
// Add a key and value for the CSV file type | |
$mimes['csv'] = "text/csv"; | |
return $mimes; | |
} | |
add_filter('upload_mimes', 'my_custom_upload_mimes'); |
Thank you @wunc, you are indeed correct =). We're the new owners and did not know about this page. We have modified it now.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just leaving a note here for the Googlers: Since 'upload_mimes' is a filter, not a hook, it should be called via:
add_filter('upload_mimes', 'my_custom_upload_mimes');