wpseo_ai_auth_method
Filter: wpseo_ai_auth_method Pin a specific AI auth strategy for QA / staged rollout.
Return 'oauth' to force MyYoast OAuth. Return 'token' to force the legacy access_jwt flow. Return any other value (including the default null) to let the factory's normal selection logic run: If OAuth is available, it will be the primary strategy with a fallback to the legacy token flow. If OAuth is unavailable, the legacy token flow will be used exclusively.
Использование
add_filter( 'wpseo_ai_auth_method', 'wp_kama_wpseo_ai_auth_method_filter', 10, 2 );
/**
* Function for `wpseo_ai_auth_method` filter-hook.
*
* @param string|null $method The forced strategy, or null for default selection.
* @param WP_User $user The WP user the request is on behalf of.
*
* @return string|null
*/
function wp_kama_wpseo_ai_auth_method_filter( $method, $user ){
// filter...
return $method;
}
- $method(строка|null)
- The forced strategy, or null for default selection.
- $user(WP_User)
- The WP user the request is on behalf of.
Где вызывается хук
wpseo_ai_auth_method
yoast/src/ai/authentication/application/ai-request-sender-factory.php 126
$forced = \apply_filters( 'wpseo_ai_auth_method', null, $user );