How to add allow ZIP files as uploads in WordPress

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.

You can leave a comment on my original post.