Allow ZIP and 7ZIP files in WordPress uploads

If you have a WordPress website, you’ll know by know it’s relatively easy to upload images and documents to WordPress’ media directory.

Uploading images and other files here allow you to link to the files in your website’s page and post content – so it’s really handy.

Default file types WordPress allows you to upload

Not all file formats are allowed to be uploaded to WordPress by default (see a list of file types WordPress allows by default here).

  • Images
    • gif
    • jpg / jpeg
    • ico
    • png
  • Documents
    • .doc, .docx
    • pdf
    • odt
    • ppt, pptx, pps, ppsx
    • psd
    • xls, xlsx
  • Audio
    • mp3
    • m4a
    • ogg
    • wav
  • Video
    • 3gp
    • 3g2
    • avi
    • mov
    • mp4, m4v
    • mpg
    • ogv
    • wmv

It’s worth noting that some hosting companies will not permit the above file types, and may restrict the maximum file size you can upload. You may also find our guide on changing the default WordPress uploads directory useful.

Allowing ZIP and 7ZIP file archive file type for WordPress uploads

To allow you to upload additional file types as well as the default file types listed above, you can modify your WordPress installation’s allowed MIME types (MIME types are a way of describing different file types):

// Add new file types
function add_file_type_uploads( $mimeTypes ) {
        $mimeTypes['zip'] = 'application/zip';
        $mimeTypes['7zip'] = 'application/x-7z-compressed'; 
        $mimeTypes['7z'] = 'application/x-7z-compressed'; 

	return $mimeTypes;
add_filter( 'upload_mimes', 'add_file_type_uploads' );

You can also remove all restrictions to file upload types, though we strongly recommend against this for security reasons. If you insist on doing this, you can add the following line to your website’s wp-config.php file:


Still stuck? Our WordPress consultancy is designed to help you solve problems with your WordPress website.