feat(myyoast-client): add wp yoast auth reset command and clear-state action#23277
Merged
Conversation
…for state reset Adds a public WordPress action that runs the same MyYoast_Client_Cleanup::execute() handler as the uninstall hook, so development tooling (e.g. yoast-test-helper) can wipe local OAuth state without uninstalling the plugin. Marked @internal — the action is for the test helper's "Clear OAuth state" button, not a long-term public extension point. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds a reset subcommand to the existing wp yoast auth command that performs the same cleanup as plugin uninstall: best-effort server-side deregistration, followed by deletion of all site/user tokens, registered client credentials, key pairs, and OIDC/JWKS/DPoP caches. Reuses MyYoast_Client_Cleanup so the CLI, uninstall, and the wpseo_myyoast_clear_client_state action all share one cleanup path. Confirms before running; --yes bypasses the prompt. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Coverage Report for CI Build 738408Warning Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes. Coverage decreased (-0.6%) to 53.342%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
Member
Author
|
marking fbr, because the test helper 1.19 depends on this |
pls78
reviewed
May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
The MyYoast OAuth client already wipes its full local state (registered client, site/user tokens, key pairs, OIDC/JWKS/DPoP caches) on plugin uninstall via
MyYoast_Client_Cleanup::execute(). The same cleanup is useful during development — switching MyYoast environments, recovering from a broken handshake, or letting the Yoast test helper offer a "Clear OAuth state" button — but until now it could only be reached by uninstalling the plugin.This PR opens two ergonomic entry points on top of that existing service:
wpseo_myyoast_clear_client_statethat runs the same cleanup handler.wp yoast auth resetWP-CLI subcommand alongside the existingwp yoast auth {status,register,verify,deregister,authorize,revoke,rotate-keys}family.Both reuse
MyYoast_Client_Cleanup::execute(), so the CLI command, the dev-tooling action, and the uninstall hook all go through one cleanup path.Summary
This PR can be summarized in the following changelog entry:
wp yoast auth resetWP-CLI command that wipes all MyYoast OAuth client state on the current site.wpseo_myyoast_clear_client_stateaction that triggers the same cleanup without uninstalling the plugin (fired by the test helper plugin).Relevant technical choices:
wpseo_myyoast_clear_client_stateaction is marked@internal— it exists for Yoast development tooling, not as a long-term public extension point.Test instructions
Test instructions for the acceptance test before the PR gets merged
This PR can be acceptance tested by following these steps:
wp-config.php, adddefine( 'YOAST_SEO_MYYOAST_CONNECTION', true );.wp yoast auth registerto register the site as an OAuth client.wp yoast auth statusand confirmregistered: yes, aclient_id, and (optionally) a site/user token.wp yoast auth reset— confirm that a prompt appears asking to wipe all MyYoast OAuth client state.yto confirm and verify the success message:MyYoast OAuth client state cleared..wp yoast auth statusagain and confirmregistered: no,client_id: -, andsite_token: none.wp yoast auth reset --yesand verify the command runs without a prompt.wp shell(or any PHP context inside WP), rundo_action( 'wpseo_myyoast_clear_client_state' );and verify the same cleanup happens.Relevant test scenarios
Test instructions for QA when the code is in the RC
Impact check
This PR affects the following parts of the plugin, which may require extra testing:
Other environments
[shopify-seo], added test instructions for Shopify and attached theShopifylabel to this PR.[yoast-doc-extension], added test instructions for Yoast SEO for Google Docs and attached theGoogle Docs Add-onlabel to this PR.Documentation