Cancel all wc-admin actions on deactivate
This commit is contained in:
parent
4f44f97a67
commit
e518f13444
|
@ -10,7 +10,4 @@ defined( 'WP_UNINSTALL_PLUGIN' ) || exit;
|
||||||
require_once dirname( __FILE__ ) . '/woocommerce-admin.php';
|
require_once dirname( __FILE__ ) . '/woocommerce-admin.php';
|
||||||
|
|
||||||
WC_Admin_Feature_Plugin::instance()->includes();
|
WC_Admin_Feature_Plugin::instance()->includes();
|
||||||
WC_Admin_Reports_Sync::clear_queued_actions();
|
|
||||||
WC_Admin_Notes::clear_queued_actions();
|
|
||||||
WC_Admin_Install::delete_table_data();
|
WC_Admin_Install::delete_table_data();
|
||||||
wp_clear_scheduled_hook( 'wc_admin_daily' );
|
|
||||||
|
|
|
@ -56,6 +56,7 @@ class WC_Admin_Feature_Plugin {
|
||||||
public function init() {
|
public function init() {
|
||||||
$this->define_constants();
|
$this->define_constants();
|
||||||
register_activation_hook( WC_ADMIN_PLUGIN_FILE, array( $this, 'on_activation' ) );
|
register_activation_hook( WC_ADMIN_PLUGIN_FILE, array( $this, 'on_activation' ) );
|
||||||
|
register_deactivation_hook( WC_ADMIN_PLUGIN_FILE, array( $this, 'on_deactivation' ) );
|
||||||
add_action( 'plugins_loaded', array( $this, 'on_plugins_loaded' ) );
|
add_action( 'plugins_loaded', array( $this, 'on_plugins_loaded' ) );
|
||||||
add_filter( 'action_scheduler_store_class', array( $this, 'replace_actionscheduler_store_class' ) );
|
add_filter( 'action_scheduler_store_class', array( $this, 'replace_actionscheduler_store_class' ) );
|
||||||
}
|
}
|
||||||
|
@ -71,6 +72,18 @@ class WC_Admin_Feature_Plugin {
|
||||||
WC_Admin_Install::create_events();
|
WC_Admin_Install::create_events();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove WooCommerce Admin scheduled actions on deactivate.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function on_deactivation() {
|
||||||
|
$this->includes();
|
||||||
|
WC_Admin_Reports_Sync::clear_queued_actions();
|
||||||
|
WC_Admin_Notes::clear_queued_actions();
|
||||||
|
wp_clear_scheduled_hook( 'wc_admin_daily' );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setup plugin once all other plugins are loaded.
|
* Setup plugin once all other plugins are loaded.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue