{ if ($post->post_type != 'wpsc-product' || !$post->post_parent) { return; } _wpsc_refresh_parent_product_terms($post->post_parent); } /** * Prevent parent terms from being refreshed when its variations are updated. This is useful when * the variations are being mass updated. * * @since 3.8.9 * @access private */ function _wpsc_remove_refresh_variation_parent_term_hooks() { remove_action('transition_post_status', '_wpsc_action_transition_post_status', 10, 3); remove_action('deleted_post', '_wpsc_action_refresh_variation_parent_terms', 10, 1); } /** * Add hooks so that parent product's assigned terms are refreshed when its variations are updated. * * @since 3.8.9 * @access private */ function _wpsc_add_refresh_variation_parent_term_hooks() { add_action('transition_post_status', '_wpsc_action_transition_post_status', 10, 3); add_action('deleted_post', '_wpsc_action_refresh_variation_parent_terms', 10, 1); } _wpsc_add_refresh_variation_parent_term_hooks();
public function process_bulk_action() { if (!empty($_REQUEST['wpsc_bulk_edit']['post'])) { $this->save_bulk_edited_items(); return; } $current_action = $this->list_table->current_action(); if (empty($current_action)) { return; } _wpsc_remove_refresh_variation_parent_term_hooks(); check_admin_referer('wpsc_product_variations_bulk_action', 'bulk_action_nonce'); $sendback = $_SERVER['REQUEST_URI']; $callback = 'process_bulk_action_' . $current_action; $post_ids = isset($_REQUEST['post']) ? $_REQUEST['post'] : array(); if (!is_array($post_ids)) { $post_ids = explode(',', $post_ids); } $post_ids = array_map('intval', $post_ids); if (!empty($post_ids) && is_callable(array($this, $callback))) { $sendback = $this->{$callback}($post_ids); } $sendback = remove_query_arg(array('_wp_http_referer', 'bulk_action', 'bulk_action2', 'bulk_action_nonce', 'confirm', 'post', 'last_paged'), $sendback); _wpsc_refresh_parent_product_terms($this->parent_id); _wpsc_add_refresh_variation_parent_term_hooks(); if ($current_action != 'edit') { wp_redirect($sendback); exit; } }