Clear recurring order milestones event on plugin deactivation.

This commit is contained in:
Jeff Stieler 2019-04-08 13:10:39 -06:00
parent 6f2c11270b
commit f734f01598
1 changed files with 8 additions and 0 deletions

View File

@ -88,6 +88,7 @@ class WC_Admin_Notes_Order_Milestones {
$this->allowed_statuses = apply_filters( 'woocommerce_admin_order_milestone_statuses', $this->allowed_statuses ); $this->allowed_statuses = apply_filters( 'woocommerce_admin_order_milestone_statuses', $this->allowed_statuses );
add_action( 'woocommerce_after_register_post_type', array( $this, 'init' ) ); 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' ) ); 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). * Get the total count of orders (in the allowed statuses).
* *