wp_trash_post($order_id); } } } /** * When a post is trashed, if its an order, sync scheduled payments * @param int $id */ public static function untrash_post($id) { if (in_array(get_post_type($id), wc_get_order_types())) { foreach (self::get_related_orders($id) as $order_id) { wp_untrash_post($order_id); } } } /** * When a post is deleted, if its an order, sync scheduled payments * @param int $id */ public static function before_delete_post($id) { if (in_array(get_post_type($id), wc_get_order_types())) { foreach (self::get_related_orders($id) as $order_id) { wp_delete_post($order_id, true); } } } } WC_Deposits_Scheduled_Order_Manager::get_instance();