Yoast\WP\SEO\MyYoast_Client\User_Interface

Auth_Command::deregisterpublicYoast 1.0

Removes the OAuth client registration.

Deletes the client registration from the authorization server and clears all local registration data and cached tokens.

OPTIONS

[--local-only]
Only delete local data without contacting the server.
[--yes]
Skip confirmation prompt.

EXAMPLES

wp yoast auth deregister
wp yoast auth deregister --local-only
wp yoast auth deregister --yes

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

Хуков нет.

Возвращает

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

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

$Auth_Command = new Auth_Command();
$Auth_Command->deregister( $args, $assoc_args ): void;
$args
.
По умолчанию: null
$assoc_args
.
По умолчанию: null

Код Auth_Command::deregister() Yoast 28.3

public function deregister( $args = null, $assoc_args = null ): void {
	if ( ! $this->myyoast_client->is_registered() ) {
		WP_CLI::warning( 'Not registered. Nothing to do.' );
		return;
	}

	WP_CLI::confirm( 'This will deregister this site from MyYoast and clear all cached tokens. Proceed?', $assoc_args );

	if ( Utils\get_flag_value( $assoc_args, 'local-only', false ) ) {
		$this->client_registration->delete_local_data();
		$this->myyoast_client->clear_all_site_tokens();
		WP_CLI::success( 'Local registration data cleared.' );
		return;
	}

	$result = $this->myyoast_client->deregister();
	$this->myyoast_client->clear_all_site_tokens();

	if ( $result ) {
		WP_CLI::success( 'Client deregistered.' );
	}
	else {
		WP_CLI::warning( 'Server-side deregistration failed (network error). Local token was cleared but client credentials remain.' );
	}
}