close
Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Docs: Fix consistency in connectors.php docblocks.
Aligns Overview, Initialization Lifecycle, and _wp_connectors_init()
to reflect that the wp_connectors_init action is primarily for overriding
metadata on existing connectors, not just registering new ones. Expands
_wp_register_default_connector_settings() to document its scope.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
  • Loading branch information
gziolo and claude committed Mar 13, 2026
commit a4f5009fb4f472e3235db3ec7372c1aebace0fb3
17 changes: 12 additions & 5 deletions src/wp-includes/connectors.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*
* The Connectors API enables developers to:
*
* - Register custom connectors with standardized interfaces.
* - Register AI provider connectors with standardized interfaces.
* - Define authentication methods and credential sources.
* - Associate connectors with WordPress.org plugins for install/activate UI.
* - Expose connector settings through the REST API with automatic key masking.
Expand Down Expand Up @@ -88,7 +88,8 @@
* 3. Auto-discovers providers from the WP AI Client registry and merges their
* metadata (name, description, logo, authentication) on top of defaults,
* with registry values taking precedence.
* 4. Fires the `wp_connectors_init` action so plugins can register additional connectors.
* 4. Fires the `wp_connectors_init` action so plugins can override metadata
* on existing connectors or register additional connectors.
* 5. Registers settings and passes stored API keys to the WP AI Client.
*
* ## Authentication
Expand Down Expand Up @@ -318,11 +319,12 @@ function _wp_connectors_resolve_ai_provider_logo_url( string $path ): ?string {
* Registry values (from provider plugins) take precedence over hardcoded fallbacks
* for name, description, logo URL, and authentication method.
* 4. Registers all connectors (built-in and AI Client-discovered) on the registry.
* 5. Fires the `wp_connectors_init` action for plugins to register additional connectors.
* 5. Fires the `wp_connectors_init` action for plugins to override metadata
* on existing connectors or register additional connectors.
*
* Built-in connectors are registered before the action fires and cannot be unhooked.
* Plugins should use the `wp_connectors_init` action to add their own connectors
* via `$registry->register()`.
* Plugins should use the `wp_connectors_init` action to override metadata or
* register new connectors via `$registry->register()`.
*
* @since 7.0.0
* @access private
Expand Down Expand Up @@ -626,6 +628,11 @@ function _wp_connectors_rest_settings_dispatch( WP_REST_Response $response, WP_R
/**
* Registers default connector settings.
*
* Only registers settings for `ai_provider` connectors with `api_key`
* authentication whose provider is present in the WP AI Client registry.
* Each setting is registered with `show_in_rest` enabled, making it
* accessible through the `/wp/v2/settings` REST endpoint.
*
* @since 7.0.0
* @access private
*/
Expand Down
Loading