How to add allow ZIP files as uploads in WordPress

- by

Years ago I added an additional MIME type to one of my websites so that I could allow a strange proprietary file type to upload directly. Back in those days, only a handful were allowed, and it included the ZIP format. I never had issues uploading those.

As the world gradually becomes a shitter place, security is tightened and I guess sometime recently ZIP files were no longer allowed in WordPress by default. Thankfully I remember how I did it, and I thought I’ll share it with you.

Add the following snippet to your functions.php file. I have it as part of my theme:

 function allow_zip_uploads ( $existing_mimes=array() ) { 
   $existing_mimes['zip'] = 'application/zip';
   $existing_mimes['gz'] = 'application/x-gzip';
   return $existing_mimes;
add_filter('upload_mimes', 'allow_brush_file_uploads'); 

This will add both ZIP and GZIP type archives to your upload allowances.

If you enjoy my content, please consider supporting me on Ko-fi. In return you can browse this whole site without any pesky ads! More details here.

1 thought on “How to add allow ZIP files as uploads in WordPress”

Leave a Comment!

This site uses Akismet to reduce spam. Learn how your comment data is processed.