ACF Gallery field images donwload

I’m using this same code and I was able to figure out where the error’s happening. The path that gets generated when this line of code is called is wrong:

$zip->open( $destination, ZipArchive::CREATE );

It spits out your home directory and then appends the value of $destination to it.

In my case (it’s not the cleanest solution, but it’s the one I ended up doing), I hard-coded the destination instead of using the variable.

$zip->open( ‘wp-content/themes/my theme/downloads/’ . sanitize_title( get_the_title() ) . ‘.zip’, ZipArchive::CREATE );

tech