Delay handling of requests to hide admin notices and limit to admin area

Moving this to `admin_init` also ensures that WC_Notes_Run_Db_Update has been instantiated before it can hook into the `woocommerce_hide_update_notice` action. See:

- WC_Install:init()
- WC_Notes_Run_Db_Update::construct()

closes #30781
This commit is contained in:
Manos Psychogyiopoulos 2021-11-03 10:28:30 +02:00
parent 9ac16a0a00
commit fb1cc38375
1 changed files with 1 additions and 1 deletions

View File

@ -51,7 +51,7 @@ class WC_Admin_Notices {
add_action( 'switch_theme', array( __CLASS__, 'reset_admin_notices' ) );
add_action( 'woocommerce_installed', array( __CLASS__, 'reset_admin_notices' ) );
add_action( 'wp_loaded', array( __CLASS__, 'add_redirect_download_method_notice' ) );
add_action( 'wp_loaded', array( __CLASS__, 'hide_notices' ) );
add_action( 'admin_init', array( __CLASS__, 'hide_notices' ), 20 );
// @TODO: This prevents Action Scheduler async jobs from storing empty list of notices during WC installation.
// That could lead to OBW not starting and 'Run setup wizard' notice not appearing in WP admin, which we want
// to avoid.