update_attachment_wccm_callback

The WooCommerce Checkout Manager update attachment wccm callback function.

Description

update_attachment_wccm_callback(); 

Usage

  1. if ( !function_exists( 'update_attachment_wccm_callback' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-checkout-manager/includes/classes/file_upload/main_upload.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = update_attachment_wccm_callback(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/includes/classes/file_upload/main_upload.php  
  1. function update_attachment_wccm_callback() { 
  2. global $post, $wpdb, $woocommerce; 
  3.  
  4. $array1 = explode( ', ', $_POST['wccm_default_keys_load']); 
  5. $array2 = explode( ', ', $_POST['product_image_gallery']); 
  6. $attachment_id_each = array_diff($array1, $array2); 
  7.  
  8. if (isset($_POST['wccm_default_keys_load'])) { 
  9. foreach($attachment_id_each as $key => $values) { 
  10. wp_delete_attachment( $attachment_id_each[$key] ); 
  11. echo ''.__('Deleted Successfully.', 'woocommerce-checkout-manager').''; 
  12. die();