I am still getting "X.epub: Sorry, this file type is not permitted for security reasons" despite adding:

define('ALLOW_UNFILTERED_UPLOADS', true);

to my wp-config.php.

Of course, I have allowed this type of file in my blog network's configuration:

enter image description here

Is this a normal situation (and using filters is the only workaround)?

Or this is something weird (like some plugin or theme overriding this) and you should keep looking for a possible cause?

EDIT (after comments and some more testing): This is .epub files-related only issue. I was able to verify that ALLOW_UNFILTERED_UPLOADS is working. The thing is that when it is enabled, it passes through all but .epub files. So, for the above screenshot, I was able to upload .azw3 and .mobi files. Out of all listed in "Upload file types" above only uploading of .epub files fails.

EDIT: This is my private blog network and I am logging via a super user account when using it.

有帮助吗?

解决方案

You probably need to allow the mime types for them to be allowed to upload.

https://www.robertwent.com/blog/adding-custom-mime-types-for-wordpress-uploads/

//The following goes in a themes functions file or a custom hooks plugin

function so_387865_custom_upload_mimes ( $existing_mimes ) {
    $existing_mimes['epub'] = 'application/epub+zip';
    $existing_mimes['mobi'] = 'application/x-mobipocket-ebook';
 
    return $existing_mimes;
}
 
add_filter('upload_mimes', 'so_387865_custom_upload_mimes');
许可以下: CC-BY-SA归因
scroll top