Yoast\WP\SEO\Helpers

Wincher_Helper::login_status()publicYoast 1.0

Checks if the user is logged in to Wincher.

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

Хуков нет.

Возвращает

true|false. The Wincher login status.

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

$Wincher_Helper = new Wincher_Helper();
$Wincher_Helper->login_status();

Код Wincher_Helper::login_status() Yoast 19.11

public function login_status() {
	try {
		$wincher = \YoastSEO()->classes->get( Wincher_Client::class );
	} catch ( Empty_Property_Exception $e ) {
		// Return false if token is malformed (empty property).
		return false;
	}

	// Get token (and refresh it if it's expired).
	try {
		$wincher->get_tokens();
	} catch ( Authentication_Failed_Exception $e ) {
		return false;
	} catch ( Empty_Token_Exception $e ) {
		return false;
	}

	return $wincher->has_valid_tokens();
}