How to get files from loop for zip
As the files are within the same WP installation (not a remote), you don’t need to download the file using get_file_contents(), try to add the file using its absolute path of the attachment. if(isset($_POST[‘download’])){ $tmpFile = tempnam(‘/tmp’, ”); $zip = new ZipArchive(); $zip->open($tmpFile, ZipArchive::CREATE); foreach( $list_posts as $list_item ) : if ( $list_item->post_type == ‘crb_photo’ …