From f734f01598fc8eae6be9fd57f083d32dbb40e935 Mon Sep 17 00:00:00 2001 From: Jeff Stieler Date: Mon, 8 Apr 2019 13:10:39 -0600 Subject: [PATCH] Clear recurring order milestones event on plugin deactivation. --- .../notes/class-wc-admin-notes-order-milestones.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/woocommerce-admin/includes/notes/class-wc-admin-notes-order-milestones.php b/plugins/woocommerce-admin/includes/notes/class-wc-admin-notes-order-milestones.php index e519073ac9b..6442ce136a1 100644 --- a/plugins/woocommerce-admin/includes/notes/class-wc-admin-notes-order-milestones.php +++ b/plugins/woocommerce-admin/includes/notes/class-wc-admin-notes-order-milestones.php @@ -88,6 +88,7 @@ class WC_Admin_Notes_Order_Milestones { $this->allowed_statuses = apply_filters( 'woocommerce_admin_order_milestone_statuses', $this->allowed_statuses ); add_action( 'woocommerce_after_register_post_type', array( $this, 'init' ) ); + register_deactivation_hook( WC_ADMIN_PLUGIN_FILE, array( $this, 'clear_scheduled_event' ) ); } /** @@ -107,6 +108,13 @@ class WC_Admin_Notes_Order_Milestones { add_action( self::PROCESS_ORDERS_MILESTONE_HOOK, array( $this, 'other_milestones' ) ); } + /** + * Clear out our hourly milestone hook upon plugin deactivation. + */ + public function clear_scheduled_event() { + wp_clear_scheduled_hook( self::PROCESS_ORDERS_MILESTONE_HOOK ); + } + /** * Get the total count of orders (in the allowed statuses). *