From fd04752cd99645bc4c2c156110c6cc50bbbd318c Mon Sep 17 00:00:00 2001 From: mpeshev Date: Sun, 25 Oct 2026 12:55:57 +0200 Subject: [PATCH 1/2] Docs: Explain the connector `type` argument of `WP_Connector_Registry::register()`. The docblock gave 'ai_provider' as the only example, which reads as if it were the only valid value. Document that any non-empty string is accepted, what 'ai_provider' changes, how other types behave, and that the type is part of the default setting name. See #66146. Co-Authored-By: Claude Opus 5.5 --- src/wp-includes/class-wp-connector-registry.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/class-wp-connector-registry.php b/src/wp-includes/class-wp-connector-registry.php index 70b967e8ab517..8074606541d7f 100644 --- a/src/wp-includes/class-wp-connector-registry.php +++ b/src/wp-includes/class-wp-connector-registry.php @@ -91,7 +91,18 @@ final class WP_Connector_Registry { * @type string $name Required. The connector's display name. * @type string $description Optional. The connector's description. Default empty string. * @type string $logo_url Optional. URL to the connector's logo image. - * @type string $type Required. The connector type, e.g. 'ai_provider'. + * @type string $type Required. The connector type. Any non-empty string is + * accepted, and several connectors may share a type. + * 'ai_provider' is the only type core treats specially. + * Such a connector is not registered when wp_supports_ai() + * is false, its API key is checked with the AI Client when + * saved (an invalid key is cleared) and passed to the AI + * Client, and the AI Client decides whether it is connected. + * For any other type, the key is saved as given, and the + * connector counts as connected when any of its key sources + * holds a key. The type is part of the default + * `setting_name`, so set `setting_name` explicitly if the + * type may change later. * @type array $authentication { * Required. Authentication configuration. * From f65077b8fb7e8d6e01448f4c9cc7dedd3b3205bd Mon Sep 17 00:00:00 2001 From: mpeshev Date: Sun, 25 Oct 2026 22:11:36 +0200 Subject: [PATCH 2/2] Docs: Scope the connector key behavior to the `api_key` method. The AI Client key check, the handoff to the AI Client and the key-based connection status only apply to connectors using the `api_key` method. Connectors using `application_password` count as connected when both a username and a password are stored, whatever their type. See #66146. Co-Authored-By: Claude Opus 5.5 --- .../class-wp-connector-registry.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/wp-includes/class-wp-connector-registry.php b/src/wp-includes/class-wp-connector-registry.php index 8074606541d7f..18d5d703b962d 100644 --- a/src/wp-includes/class-wp-connector-registry.php +++ b/src/wp-includes/class-wp-connector-registry.php @@ -95,14 +95,17 @@ final class WP_Connector_Registry { * accepted, and several connectors may share a type. * 'ai_provider' is the only type core treats specially. * Such a connector is not registered when wp_supports_ai() - * is false, its API key is checked with the AI Client when - * saved (an invalid key is cleared) and passed to the AI - * Client, and the AI Client decides whether it is connected. - * For any other type, the key is saved as given, and the - * connector counts as connected when any of its key sources - * holds a key. The type is part of the default - * `setting_name`, so set `setting_name` explicitly if the - * type may change later. + * is false. For connectors using the 'api_key' method, an + * 'ai_provider' key is checked with the AI Client when saved + * (an invalid key is cleared) and passed to the AI Client, + * which decides whether it is connected; for any other type, + * the key is saved as given, and the connector counts as + * connected when any of its key sources holds a key. + * Connectors using the 'application_password' method count + * as connected when both a username and a password are + * stored, whatever their type. The type is part of the + * default `setting_name`, so set `setting_name` explicitly + * if the type may change later. * @type array $authentication { * Required. Authentication configuration. *