Yoast_Notification_Center::restore_notification
Restores a notification.
Метод класса: Yoast_Notification_Center{}
Хуков нет.
Возвращает
bool. True if restored, false otherwise.
Использование
$result = Yoast_Notification_Center::restore_notification( $notification );
- $notification(Yoast_Notification) (обязательный)
- Notification to restore.
Код Yoast_Notification_Center::restore_notification() Yoast Notification Center::restore notification Yoast 28.4
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;
}