Merge pull request #19772 from woocommerce/update/notice-display
Only show notices on specific screens
This commit is contained in:
commit
9679e7be1f
|
@ -152,7 +152,22 @@ class WC_Admin_Notices {
|
|||
public static function add_notices() {
|
||||
$notices = self::get_notices();
|
||||
|
||||
if ( ! empty( $notices ) ) {
|
||||
if ( empty( $notices ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$screen = get_current_screen();
|
||||
$screen_id = $screen ? $screen->id : '';
|
||||
$show_on_screens = array(
|
||||
'dashboard',
|
||||
'plugins',
|
||||
);
|
||||
|
||||
// Notices should only show on WooCommerce screens, the main dashboard, and on the plugins screen.
|
||||
if ( ! in_array( $screen_id, wc_get_screen_ids(), true ) && ! in_array( $screen_id, $show_on_screens, true ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
wp_enqueue_style( 'woocommerce-activation', plugins_url( '/assets/css/activation.css', WC_PLUGIN_FILE ), array(), WC_VERSION );
|
||||
|
||||
// Add RTL support.
|
||||
|
@ -166,7 +181,6 @@ class WC_Admin_Notices {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a custom notice.
|
||||
|
|
Loading…
Reference in New Issue