Skip to content

Commit

Permalink
Adds filter to show admin notice
Browse files Browse the repository at this point in the history
  • Loading branch information
ibndawood committed Oct 2, 2023
1 parent e7bf974 commit a8579b7
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/php/compat-checker/src/Checks/CompatCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,22 @@ protected function add_admin_notice( $slug, $class, $message ) {
return;
}

$screen = get_current_screen();
$hidden = array( 'update', 'update-network', 'update-core', 'update-core-network', 'upgrade', 'upgrade-network', 'network' );
$show = isset( $screen->id ) && ! in_array( $screen->id, $hidden, true );

/**
* The Compat Check filter to show an admin notice.
*
* @since 0.0.1
*
* @param bool $show Whether to show the admin notice.
* @param string $slug The slug for the notice.
*/
if ( ! apply_filters( 'wc_grow_compat_check_show_admin_notice', $show, $slug ) ) {
return;
}

$this->notices[ $slug ] = array(
'class' => $class,
'message' => $message,
Expand Down

0 comments on commit a8579b7

Please sign in to comment.