From b2e4d8f074527cd1ccf8806a5d17b835e17b9df8 Mon Sep 17 00:00:00 2001 From: ale <ale@incal.net> Date: Mon, 5 Jun 2023 18:20:46 +0100 Subject: [PATCH] Allow upload of epub files via mime-type fix --- upload-mime-types.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/upload-mime-types.php b/upload-mime-types.php index bdf5e41..6de0196 100644 --- a/upload-mime-types.php +++ b/upload-mime-types.php @@ -27,3 +27,16 @@ add_filter( 'wp_check_filetype_and_ext', function( $types, $file, $filename, $mi } return $types; }, 1, 5); + +/* Allow upload of other MIME types. + * + * These are easier as there's no possibility of misidentification. + */ +function ai_mu_edit_upload_types($existing_mimes = array()) { + // allow .epub + $existing_mimes['epub'] = 'application/epub+zip'; + + return $existing_mimes; +} + +add_filter('upload_mimes', 'ai_mu_edit_upload_types'); -- GitLab