WC_Admin_Notices::user_has_dismissed_notice │ public static │ WC 8.5.0

Check if a given user has dismissed a given admin notice.

Метод класса: WC_Admin_Notices{}

Хуков нет.

Возвращает

bool. True if the user has dismissed the notice.

Использование

$result = WC_Admin_Notices::user_has_dismissed_notice( $name, ?int $user_id ): bool;
$name(строка) (обязательный)
The name of the admin notice to check.
?int $user_id
.
По умолчанию: null

Список изменений

С версии 8.5.0 Введена.

Код WC_Admin_Notices::user_has_dismissed_notice() WC 11.3.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 );
}