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
- Inserting Gravity Form checkbox values into Advanced Custom Fields [closed]
- 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
- Conditional statement for parent, child and grandchild pages
- The values of custom fields are not available functions.php
- Adding Image Count to Multigallery
- Get a Page’s attachments in Gallery order
- Problem with ACF shortcode with Repeater Field in WordPress? [closed]
- Download PDF after CF7 form submission
- How to create an ACF shortcode with Repeater Field in WordPress? [duplicate]
- Get title attribute from galleries
- Detecting if parent page has gallery
- WordPress gallery shortag
- Timthumb.php image gallery not working on Multisite WordPress
- Upload non-featured image to image field
- HTML Special Characters in URL string [closed]
- ACF put a comma after the last repeater field value [closed]
- Show ACF field with link to ultimate member profile/WordPress user profile below the post (single post layout)
- 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
- ACF Repeater Pagination stopped working since upgrade to php7.2
- How can I count ACF sub_field with a certain value
- Change default gallery images – Currently they are displaying full size imagese
- what is the method to echo class attribute inside the i tag? [closed]
- Refactoring long if/else php chains
- 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?
- Show get_sub_field value if it exists [closed]
- Update post meta – Custom field does not match meta-key
- Advanced Custom Fields [closed]
- ACF Unexpected T_CONSTANT_ENCAPSED_STRING [closed]
- Including Custom fields within the_content
- Get All In One SEO Pack to use custom field instead of Content
- Remove Post if Advanced Custom Field is checked to fix paging
- Auto create Nextgen Gallery on post creation [closed]
- Update user repeater meta (ACF) with another user meta field value
- 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
- Display acf taxonomy attachment
- Nested Queries of decreasing specificity
- Get main parent category for post (WordPress/Advanced Custom Fields)
- Create shortcode for metabox gallery
- ACF: Display Google Map in frontend issues
- 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?
- ACF Taxonomy field values not select in backend
- Set ACF on order during checkout
- If Statement is Ignored?
- Use WPQuery to match to specific repeater row in post
- Query on a repeater date (acf)
- ACF values to Script with auto refresh
- ACF relationship on user profile page used for allowed access
- ACF – Can’t get custom post type by taxonomy
- Advance custom fields variable with if statement & Function
- ElseIf Statement with ACF Group field
- 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
- Place product field value as variable in php
- ACF – Get ID of relationship field in flexible content
- 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
- Get list of posts from attachment
- How to output values from a loop into a javascript array
- Pulling Products from an API
- 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]
- Scheduling a post using publish date from a custom field. Resulting post is set as published in the future instead of scheduled
- 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
- Ordering / grouping posts by datepicker ACF
- PHP for loop not working as intended
- Position a repeated article blocks
- 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]