zip unzip attachments in wordpress
WordPress provides a function called unzip_file()— easily found by typing “wordpress unzip” into Google. There is sample code in the Codex: WP_Filesystem(); $destination = wp_upload_dir(); $destination_path = $destination[‘path’]; $unzipfile = unzip_file( $destination_path.’/filename.zip’, $destination_path); if ( $unzipfile ) { echo ‘Successfully unzipped the file!’; } else { echo ‘There was an error unzipping the file.’; } … Read more