Yoast_Notification_Center::clear_dismissal()publicYoast 1.0

Clear dismissal information for the specified Notification.

When a cause is resolved, the next time it is present we want to show the message again.

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

Хуков нет.

Возвращает

true|false.

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

$Yoast_Notification_Center = new Yoast_Notification_Center();
$Yoast_Notification_Center->clear_dismissal( $notification );
$notification(строка|Yoast_Notification) (обязательный)
Notification to clear the dismissal of.

Код Yoast_Notification_Center::clear_dismissal() Yoast 19.6.1

public function clear_dismissal( $notification ) {

	global $wpdb;

	if ( $notification instanceof Yoast_Notification ) {
		$dismissal_key = $notification->get_dismissal_key();
	}

	if ( is_string( $notification ) ) {
		$dismissal_key = $notification;
	}

	if ( empty( $dismissal_key ) ) {
		return false;
	}

	// Remove notification dismissal for all users.
	$deleted = delete_metadata( 'user', 0, $wpdb->get_blog_prefix() . $dismissal_key, '', true );

	// Delete unprefixed user meta too for backward-compatibility.
	$deleted = delete_metadata( 'user', 0, $dismissal_key, '', true ) || $deleted;

	return $deleted;
}