Since you already have the image IDs, this makes it easy. Just copy the code snippet below into your theme’s functions.php file, then refresh your homepage once. It will immediately deliver a ZIP file containing all your images.
// === Function to convert array of IDs to a ZIP file ===
function ids_to_zip($ids, $name = 'images') {
if (!class_exists('ZipArchive')) wp_die('ZipArchive missing');
$zip = new ZipArchive;
$tmp = sys_get_temp_dir() . '/' . $name . '.zip';
if ($zip->open($tmp, ZipArchive::CREATE | ZipArchive::OVERWRITE) !== true) wp_die('Cannot create zip');
foreach ($ids as $id) {
$file = get_attached_file($id);
if ($file) $zip->addFile($file, basename($file));
}
$zip->close();
header('Content-Type: application/zip');
header('Content-Disposition: attachment; filename="' . $name . '.zip"');
readfile($tmp);
unlink($tmp);
exit;
}
// === How to use it – replace the IDs with your own ===
$my_ids = array(101, 102, 103, 104); // ← Put your actual image IDs here
ids_to_zip($my_ids, 'my-300-images');
Note: After refreshing the homepage once, the ZIP file will automatically download. To avoid re-running the code on every page load, remove or comment out the usage lines after your download is complete.