Programmatically Upload and Unpack ZIP files in WordPress

Programmatically Upload and Unpack ZIP files in WordPress

Author: Igor Benic

Date: October 26, 2020 

Category: Tutorials

ZIP Files are not allowed in WordPress by default but you might want to have a way to upload them and unpack them. For example, how WordPress uploads and unpacks plugin ZIP files.

The code we will write, you can add to your theme or in an existing plugin. You can also add a form to a shortcode or add it directly to a template.

We will create a separate plugin.

Plugin to Upload ZIP files

In our main class we will store any errors on notices that we could get while processing the upload.

We are also hooking


World of WordPress is hosted by:

Servebolt: next level high performance hosting.

While others try to add more components to their hosting to make it go faster, we decided to build our hosting cloud fast from the ground up. We did so by stripping out everything we knew was deadweight.