admin管理员组文章数量:1289880
I cannot upload .zip files to my Wordpress network, despite making IMHO everything that is needed. I am still hit by this irritating error.
Details:
- I am a super-admin in my network.
- The
ALLOW_UNFILTERED_UPLOADS
flag is set totrue
- Custom hook of
$existing_mimes['zip'] = 'application/zip';
is added - Uploading .zip files is allowed in my network:
Here is entire code of my hook:
function so_387865_custom_upload_mimes ( $existing_mimes ) {
$existing_mimes['epub'] = 'application/epub+zip';
$existing_mimes['mobi'] = 'application/x-mobipocket-ebook';
$existing_mimes['zip'] = 'application/zip';
return $existing_mimes;
}
add_filter('upload_mimes', 'so_387865_custom_upload_mimes');
I thought that maybe there's something wrong with the hook, so I have installed the Enhanced Media Library extension (as suggested in here). All for nothing, as it clearly shows that this MIME type is added:
What else should I do in order to be able to upload .zip files? I am seriously lost!
EDIT: As suggested in here, this custom hook is added directly (custom_hooks.php
file in wp-content/mu-plugins/
folder). While most guides in the net says about adding custom mimes directly in the theme's code. Maybe this is a problem?
I cannot upload .zip files to my Wordpress network, despite making IMHO everything that is needed. I am still hit by this irritating error.
Details:
- I am a super-admin in my network.
- The
ALLOW_UNFILTERED_UPLOADS
flag is set totrue
- Custom hook of
$existing_mimes['zip'] = 'application/zip';
is added - Uploading .zip files is allowed in my network:
Here is entire code of my hook:
function so_387865_custom_upload_mimes ( $existing_mimes ) {
$existing_mimes['epub'] = 'application/epub+zip';
$existing_mimes['mobi'] = 'application/x-mobipocket-ebook';
$existing_mimes['zip'] = 'application/zip';
return $existing_mimes;
}
add_filter('upload_mimes', 'so_387865_custom_upload_mimes');
I thought that maybe there's something wrong with the hook, so I have installed the Enhanced Media Library extension (as suggested in here). All for nothing, as it clearly shows that this MIME type is added:
What else should I do in order to be able to upload .zip files? I am seriously lost!
EDIT: As suggested in here, this custom hook is added directly (custom_hooks.php
file in wp-content/mu-plugins/
folder). While most guides in the net says about adding custom mimes directly in the theme's code. Maybe this is a problem?
1 Answer
Reset to default 4The issue has nothing to do with the source code of a theme or plugin or with the configuration of Wordpress. It is:
- a 6+ months old bug in File block in Gutenberg that narrows down to
- a 4+ years old bug in core Wordpress.
No solution exists for the moment, except for uploading files via Media section of Wordpress Dasboard. As file upload through that way are 100% working without any problems.
本文标签: hooksWhat conditions must be met in order to upload zip file to a multisite Wordpress installation
版权声明:本文标题:hooks - What conditions must be met in order to upload .zip file to a multisite Wordpress installation? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741465697a2380300.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
application/zip
looks pretty standard to my eye. Have you tried giving youradd_filter()
call a higher priority (ie, change it toadd_filter('upload_mimes', 'so_387865_custom_upload_mimes', 20 );
)? – Pat J Commented Jul 3, 2021 at 2:091
not20
in order to give in higher priority. Anyway, nothing helped, neither20
nor1
. But... As for my question. It seems it is off-topic, because this clearly is some bug in Gutenberg's File block type. I can upload these files without any problems into my Media section of the very same files. Only direct upload to File block fails. – trejder Commented Jul 4, 2021 at 11:481
returnsfoo
and one at priority100
returnsbar
, then WP will receive the later one and it'll bebar
. – Pat J Commented Jul 4, 2021 at 19:48