Yoast_Notification_Center::restore_notification()public staticYoast 1.0

Restores a notification.

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

Хуков нет.

Возвращает

true|false. True if restored, false otherwise.

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

$result = Yoast_Notification_Center::restore_notification( $notification );
$notification(Yoast_Notification) (обязательный)
Notification to restore.

Код Yoast_Notification_Center::restore_notification() Yoast 22.3

public static function restore_notification( Yoast_Notification $notification ) {

	$user_id       = get_current_user_id();
	$dismissal_key = $notification->get_dismissal_key();

	// Restore notification.
	$restored = delete_user_option( $user_id, $dismissal_key );

	// Delete unprefixed user meta too for backward-compatibility.
	if ( metadata_exists( 'user', $user_id, $dismissal_key ) ) {
		$restored = delete_user_meta( $user_id, $dismissal_key ) && $restored;
	}

	return $restored;
}