I want my multisite network to be able to upload and distribute files that are not allowed by default. In multisite network settings there is a field for adding additional file formats. However this only works for very specific file formats.
According to the advice from here and here I added the following code to my theme's functions.php
:
function my_new_custom_mime_types( $mimes ) {
$mimes['pem'] = 'application/x-pem-file';
return $mimes;
}
add_filter( 'upload_mimes', 'my_new_custom_mime_types', 1 );
However I still got the same error that I am not allowed to upload such a file. The file type is not listed in the choose file dialog so I have to select All files (*.*)
or use drag and drop.
Someone had the same problem and had to adjust the extensions and mime types at five to eight different spaces. Unfortunately he or she did not publish the solution.
Can anyone list all the steps necessary to allow a file type when multisite is enabled?
Edit: Although I tested with extension .pem
and mimetype application/x-pem-file
my list of file types is not yet complete so telling plugin x will enable pem uploads is not the answer for this question.
add_filter()
code that caused your 500 error; it might be something that we can help you debug.mime_types
filter will allow you to add more MIME types to the default list of allowed MIME types. (That's what filters do in WordPress: they allow you to change how the system works without having to update core files.)