I have been trying to use the unzip_file()
function. It says undefined
so I looked into it and the WP_Filesystem()
must be called and set up. So easy, right?
require_once(ABSPATH .'/wp-admin/includes/file.php');
WP_Filesystem();
unzip_file( $zip, $dest );
Even this shows as undefined
, and I don’t see any documentation on it. I am trying to use the unzip feature to unpack a separate plugin during theme install.
Maybe some error handling make it easier.
If you can’t get WordPress to unzip the file, PHP has its own zip file implementation (documentation can be found at http://php.net/manual/en/book.zip.php). Simple examples can be found at http://www.php.net/manual/en/zip.examples.php.