0

Wordpress 4.8

When an unsupported file is attempted to be uploaded via the WP Media Library the following error message is displayed:

Sorry, this file type is not permitted for security reasons.

Is there a way (eg filter) that will allow this error message to be manipulated, such as:

Sorry, this file type is not permitted for security reasons. Please ZIP the file and try uploading the ZIP file instead.

(Obviously support is added to allow ZIP files)

3
  • Looking through the core, there doesn't seem to be any filter, however you could probably use the media upload javascript actions to hook in and add your own... This answer may help get you started. Jul 12, 2017 at 13:46
  • Thanks @brianjohnhanna, I can confirm that this allows me to obtain the error message, however, this will work when uploading on the Media > Library page, but does not work on the Media > Add New page. Media > Add New wp.Uploader is typeof:undefined whereas on Media > Library wp.Uploader is typeof:function Jul 12, 2017 at 14:17
  • Just an FYI: looking at scripts-loader.php, I see the array of error message strings ( $uploader_l10n ) is localized to scripts at L312, L315 and L324 via class.wp-scripts.php's localize() method. But, see no filter hooks.
    – hwl
    Jul 12, 2017 at 14:58

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.