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 );
Related Posts:
- Delete images from media library when user deletes an image from ACF Gallery
- Javascript Tab Gallery with Advanced Custom Fields
- How to manually fix the WordPress gallery code using PHP in functions.php?
- Display all values of custom a field created with ACF on a page
- How to draw media details for Isotope gallery using Photoswipe
- Conditionally loading JavaScript based on the Advanced Custom Fields in the post
- If Custom Field is empty don’t display div
- PHP/Manual use of images? – 2 Questions
- Is there a reason why my wordpress PHP page isn’t loading into my PHP template
- The values of custom fields are not available functions.php
- Problem with ACF shortcode with Repeater Field in WordPress? [closed]
- How to Explode a Textarea Field and Echo each line separately, wrapped with HTML
- Advanced Custom Fields: Post Object – Not returning data [closed]
- ACF: Only get first row of a Repeater Field
- Importing hard coded custom field into acf field
- Strip characters, Including spaces, for tel: link
- How can I add multiple ‘tax_query’ arrays via a loop?
- Change output based on text field value
- Using Advanced Custom Fields to create a per page slider
- Display PHP within HTML values
- Showing a different gallery in a seperate post
- Create own WordPress shortcode gallery
- Saving an array of dynamic repeater data as post_meta
- How to get next image with this code from same post?
- Unread Repeater field IMG alt not working
- Unable to write multiple values back to ACF user field – PHP
- Update grandchild repeater field with value per row
- Slick + PHP + ACF + JQuery slide reveal not working
- Way to add captions to gallery images by code
- Sort by page information by Ascending Numbers
- Custom gallery in wp3.5
- Advanced Custom Fields not displaying
- Download PDF after CF7 form submission
- How to create an ACF shortcode with Repeater Field in WordPress? [duplicate]
- Detecting if parent page has gallery
- Timthumb.php image gallery not working on Multisite WordPress
- Upload non-featured image to image field
- HTML Special Characters in URL string [closed]
- Form search query – displaying ACF “Post Object” field as results
- InnerBlocks with allowedBlocks not working with acf_register_block
- Accessing values from ACF sub field (flexible content area) in PHP
- Creating an image from a custom field
- Can I set up a hover animation in CSS depending on a PHP conditional?
- Get ACF options field in PHP acting as CSS
- ACF & Bootstrap Gallery Shows Blank Slides [closed]
- Conditional multidimensional arrays and array_map
- How can I count ACF sub_field with a certain value
- Change default gallery images – Currently they are displaying full size imagese
- Getting taxonomy category Image from ACF [closed]
- Problem with adding custom CSS class to image in ACF Photo Gallery plugin [closed]
- How do I increase the upload size only when editing special pages?
- Advanced Custom Fields [closed]
- ACF Unexpected T_CONSTANT_ENCAPSED_STRING [closed]
- Get All In One SEO Pack to use custom field instead of Content
- Auto create Nextgen Gallery on post creation [closed]
- Display Post Title From Select Choice Loop in Advanced Custom Fields (ACF) – WordPress
- Add class to all img if they have a certain ACF field
- Foreach loop is unexpectedly outputting an extra empty a tag
- How to store checkbox data for individual users?
- Problems updating nested ACF field groups
- Create shortcode for metabox gallery
- Bootstrap 4 Carosuel with ACF Repeater field
- Display metabox galleries on specific page template in admin editor
- How to display acf field values from home page on all pages?
- Set ACF on order during checkout
- If Statement is Ignored?
- Query on a repeater date (acf)
- ACF values to Script with auto refresh
- Advanced Custom Forms PHP formatting for do_shortcode
- Possible to edit custom date field and display?
- Get field value and use as variable in php
- add custom link to gallery images
- ACF under category name in shop page [closed]
- get_template_part() not working with Advanced Custom Fields plugin
- List all ACF field values across every post on one page
- PHP/CSS: Shortcode won’t display correctly, and only displays in the head (before content)
- ACF background-color per post in a WordPress loop
- How can I copy an ACF field to AIOSEO field? [closed]
- Make sticky post with FacetWP
- How to generate customized filtered output for the gallery
- Generate a radius search of custom post type locations
- WooCommerce Custom Tab with ACF Repeater Field
- PHP for loop not working as intended
- Is there a reason why my wordpress PHP page isn’t loading into my PHP template
- ACF + WP + Slick Slider Repeater Slide Group PHP not Displaying [closed]
- Display a single row from nested array of custom field data
- Else if Statement for Advanced Custom Fields [closed]
- Top menu disapears in Category Pages when filtering using ACF
- Creating image gallery in wordpress
- ACF loop and php formatting
- Dynamic Gallery
- Gallery requires a featured image but does not show it in posts/pages
- get_category only returning details for ‘uncategorized’
- Custom field within shortcode
- ACF allow zero as a value
- ACF Date fileds to Age Convert [closed]
- Advanced custom fields Repeater conditional statement not working [closed]
- Order woo products, but first products must be with acf fields
- advanced custom fields: repeater field within conditional statement [closed]
- ACF number less than comparison not working