WPSEO_Product_Upsell_Notice::dismiss_notice_listener()publicYoast 1.0

Listener for the upsell notice.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

$WPSEO_Product_Upsell_Notice = new WPSEO_Product_Upsell_Notice();
$WPSEO_Product_Upsell_Notice->dismiss_notice_listener();

Код WPSEO_Product_Upsell_Notice::dismiss_notice_listener() Yoast 24.0

public function dismiss_notice_listener() {
	// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Reason: We are validating a nonce here.
	if ( ! isset( $_GET['_wpnonce'] ) || ! wp_verify_nonce( $_GET['_wpnonce'], 'dismiss-5star-upsell' ) ) {
		return;
	}

	$dismiss_upsell = isset( $_GET['yoast_dismiss'] ) && is_string( $_GET['yoast_dismiss'] ) ? sanitize_text_field( wp_unslash( $_GET['yoast_dismiss'] ) ) : '';

	if ( $dismiss_upsell !== 'upsell' ) {
		return;
	}

	$this->dismiss_notice();

	if ( wp_safe_redirect( admin_url( 'admin.php?page=wpseo_dashboard' ) ) ) {
		exit;
	}
}