diff --git a/includes/class-wc-install.php b/includes/class-wc-install.php index f71f0369047..782b28b7854 100644 --- a/includes/class-wc-install.php +++ b/includes/class-wc-install.php @@ -156,7 +156,7 @@ class WC_Install { public static function init() { add_action( 'init', array( __CLASS__, 'check_version' ), 5 ); add_action( 'init', array( __CLASS__, 'manual_database_update' ), 20 ); - add_action( 'plugins_loaded', array( __CLASS__, 'wc_admin_db_update_notice' ), 100 ); + add_action( 'admin_init', array( __CLASS__, 'wc_admin_db_update_notice' ) ); add_action( 'woocommerce_run_update_callback', array( __CLASS__, 'run_update_callback' ) ); add_action( 'admin_init', array( __CLASS__, 'install_actions' ) ); add_filter( 'plugin_action_links_' . WC_PLUGIN_BASENAME, array( __CLASS__, 'plugin_action_links' ) ); @@ -194,7 +194,10 @@ class WC_Install { * @since 4.0.0 */ public static function wc_admin_db_update_notice() { - if ( WC()->is_wc_admin_active() ) { + if ( + WC()->is_wc_admin_active() && + false !== get_option( 'woocommerce_admin_install_timestamp' ) + ) { new WC_Notes_Run_Db_Update(); } } @@ -261,11 +264,6 @@ class WC_Install { check_admin_referer( 'wc_db_update', 'wc_db_update_nonce' ); self::update(); WC_Admin_Notices::add_notice( 'update', true ); - if ( WC()->is_wc_admin_active() ) { - // Pre-init data store override to allow storing WC Admin notice during activation (package is not loaded yet). - add_filter( 'woocommerce_data_stores', array( '\Automattic\WooCommerce\Admin\API\Init', 'add_data_stores' ) ); - WC_Notes_Run_Db_Update::show_reminder(); - } } } @@ -381,12 +379,6 @@ class WC_Install { self::update(); } else { WC_Admin_Notices::add_notice( 'update', true ); - - // Pre-init data store override to allow storing WC Admin notice during activation (package is not loaded yet). - if ( WC()->is_wc_admin_active() ) { - add_filter( 'woocommerce_data_stores', array( '\Automattic\WooCommerce\Admin\API\Init', 'add_data_stores' ) ); - WC_Notes_Run_Db_Update::show_reminder(); - } } } else { self::update_db_version();