diff --git a/docs/customization/yoast-seo/filters/myyoast-oauth-redirect-uri-filters.md b/docs/customization/yoast-seo/filters/myyoast-oauth-redirect-uri-filters.md new file mode 100644 index 00000000..6370ebe1 --- /dev/null +++ b/docs/customization/yoast-seo/filters/myyoast-oauth-redirect-uri-filters.md @@ -0,0 +1,116 @@ +--- +id: myyoast-oauth-redirect-uri-filters +title: "Yoast SEO: Customize MyYoast OAuth redirect URIs" +sidebar_label: MyYoast OAuth redirect URI filters +--- + +Yoast SEO uses an OAuth 2.0 flow to connect your site to MyYoast. In standard WordPress setups the plugin automatically determines the correct OAuth callback URL. For non-standard setups — reverse proxies, alternate admin URLs, staging environments with custom domains — two filters let you override these URLs. + +## `wpseo_myyoast_redirect_uris` + +**Source**: `src/myyoast-client/infrastructure/wordpress/redirect-uri-provider.php` + +Filters the redirect URIs registered with MyYoast for this site. The plugin registers a list of allowed callback URLs with the MyYoast OAuth server. By default the list contains only the site's canonical admin callback URL. Use this filter to add extra URIs (e.g. because your site is reachable via multiple hostnames), to replace the canonical URL, or to remove URIs that should not be allowed. + +The returned value must be an array of non-empty strings. If the filter empties the array, Yoast SEO falls back to the canonical admin callback URL so that at least one URI is always registered. + +### Parameters + +| Parameter | Type | Description | +|---|---|---| +| `$redirect_uris` | `string[]` | The redirect URIs to register. Defaults to an array containing only the canonical admin callback URL. | + +### Usage + +#### Adding an extra redirect URI for a reverse-proxy domain + +```php +