WC_Admin_Notices::user_has_dismissed_notice
Check if a given user has dismissed a given admin notice.
Method of the class: WC_Admin_Notices{}
No Hooks.
Returns
true|false. True if the user has dismissed the notice.
Usage
$result = WC_Admin_Notices::user_has_dismissed_notice( $name, ?int $user_id ): bool;
- $name(string) (required)
- The name of the admin notice to check.
- ?int $user_id
- .
Default:null
Changelog
| Since 8.5.0 | Introduced. |
WC_Admin_Notices::user_has_dismissed_notice() WC Admin Notices::user has dismissed notice code WC 10.5.0
public static function user_has_dismissed_notice( string $name, ?int $user_id = null ): bool {
return (bool) get_user_meta( $user_id ?? get_current_user_id(), "dismissed_{$name}_notice", true );
}