bobbingwide / oik-clone

Clone content between sites
https://www.oik-plugins.com/oik-plugins/oik-clone-clone-your-wordpress-content/
GNU General Public License v2.0
5 stars 0 forks source link

Investigate cloning of Easy Digital Downloads downloads #45

Open bobbingwide opened 4 years ago

bobbingwide commented 4 years ago

For WP-a2z we need Easy Digital Download products in multiple sites. They’re needed to give live examples for blocks which use them. The existing cloning logic is not enough.

Expected result

When a post of type download is cloned:

Example meta data for a 'download' with post ID 3089 is:

meta_key example meta_value notes
_edd_bundled_products serialised
_edd_bundled_products_conditions serialised
_edd_download_earnings 0.00 price
_edd_download_sales 0 integer
edd_download_files see below serialised
edd_price 0.99 price
edd_product_notes These are special notes... textarea
edd_variable_prices serialised

Download files is a serialised array. EDD moves the files to a special subdirectory of the uploads folder ( default name edd ) where it protects them from direct access.

a:1:{i:1;a:6:{s:5:"index";s:1:"0";s:13:"attachment_id";s:4:"3090";s:14:"thumbnail_size";s:5:"false";s:4:"name";s:25:"My Favourite Block v0.0.0";s:4:"file";s:91:"https://blocks.wp.a2z/wp-content/uploads/sites/10/edd/2019/10/My-Favourite-Block-v0.0.0.pdf";s:9:"condition";s:3:"all";}}

Actual result

Attachments are not cloned. Also need to check what else doesn't get cloned correctly!

Proposed solution

This is similar to #44 and may share a similar solution.

Note: The EDD 'download' CPT does not support show_in_rest out of the box.