Yoast\WP\SEO\Actions\Wincher

Wincher_Account_Action::check_limitpublicYoast 1.0

Checks the account limit for tracking keyphrases.

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

Хуков нет.

Возвращает

Объект. The response object.

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

$Wincher_Account_Action = new Wincher_Account_Action();
$Wincher_Account_Action->check_limit();

Код Wincher_Account_Action::check_limit() Yoast 28.0

public function check_limit() {
	// Code has already been validated at this point. No need to do that again.
	try {
		$results = $this->client->get( self::ACCOUNT_URL );

		$usage   = ( $results['limits']['keywords']['usage'] ?? null );
		$limit   = ( $results['limits']['keywords']['limit'] ?? null );
		$history = ( $results['limits']['history_days'] ?? null );

		return (object) [
			'canTrack'    => ( $limit === null || $usage < $limit ),
			'limit'       => $limit,
			'usage'       => $usage,
			'historyDays' => $history,
			'status'      => 200,
		];
	} catch ( Exception $e ) {
		return (object) [
			'status' => $e->getCode(),
			'error'  => $e->getMessage(),
		];
	}
}