Skip to content

Commit e8387df

Browse files
committed
chore: post merge cleanup
1 parent e0719a0 commit e8387df

File tree

1 file changed

+17
-46
lines changed

1 file changed

+17
-46
lines changed

src/wp-includes/connectors.php

Lines changed: 17 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -341,24 +341,26 @@ function _wp_connectors_init(): void {
341341
/**
342342
* Fires when the connector registry is ready for plugins to register connectors.
343343
*
344-
* Default connectors have already been registered at this point and cannot be
345-
* unhooked. Use `$registry->register()` within this action to add new connectors.
344+
* Built-in connectors and any AI providers auto-discovered from the WP AI Client
345+
* registry have already been registered at this point and cannot be unhooked.
346+
*
347+
* AI provider plugins that register with the WP AI Client do not need to use
348+
* this action — their connectors are created automatically. This action is
349+
* primarily for registering non-AI-provider connectors or overriding metadata
350+
* on existing connectors.
351+
*
352+
* Use `$registry->register()` within this action to add new connectors.
353+
* To override an existing connector, unregister it first, then re-register
354+
* with updated data.
346355
*
347-
* Example usage:
356+
* Example — overriding metadata on an auto-discovered connector:
348357
*
349358
* add_action( 'wp_connectors_init', function ( WP_Connector_Registry $registry ) {
350-
* $registry->register(
351-
* 'my_custom_ai',
352-
* array(
353-
* 'name' => __( 'My Custom AI', 'my-plugin' ),
354-
* 'description' => __( 'Custom AI provider integration.', 'my-plugin' ),
355-
* 'type' => 'ai_provider',
356-
* 'authentication' => array(
357-
* 'method' => 'api_key',
358-
* 'credentials_url' => 'https://example.com/api-keys',
359-
* ),
360-
* )
361-
* );
359+
* if ( $registry->is_registered( 'openai' ) ) {
360+
* $connector = $registry->unregister( 'openai' );
361+
* $connector['description'] = __( 'Custom description for OpenAI.', 'my-plugin' );
362+
* $registry->register( 'openai', $connector );
363+
* }
362364
* } );
363365
*
364366
* @since 7.0.0
@@ -475,37 +477,6 @@ function _wp_connectors_register_default_ai_providers( WP_Connector_Registry $re
475477
foreach ( $defaults as $id => $args ) {
476478
$registry->register( $id, $args );
477479
}
478-
479-
/**
480-
* Fires when the connector registry is ready for plugins to register connectors.
481-
*
482-
* Built-in connectors and any AI providers auto-discovered from the WP AI Client
483-
* registry have already been registered at this point and cannot be unhooked.
484-
*
485-
* AI provider plugins that register with the WP AI Client do not need to use
486-
* this action — their connectors are created automatically. This action is
487-
* primarily for registering non-AI-provider connectors or overriding metadata
488-
* on existing connectors.
489-
*
490-
* Use `$registry->register()` within this action to add new connectors.
491-
* To override an existing connector, unregister it first, then re-register
492-
* with updated data.
493-
*
494-
* Example — overriding metadata on an auto-discovered connector:
495-
*
496-
* add_action( 'wp_connectors_init', function ( WP_Connector_Registry $registry ) {
497-
* if ( $registry->is_registered( 'openai' ) ) {
498-
* $connector = $registry->unregister( 'openai' );
499-
* $connector['description'] = __( 'Custom description for OpenAI.', 'my-plugin' );
500-
* $registry->register( 'openai', $connector );
501-
* }
502-
* } );
503-
*
504-
* @since 7.0.0
505-
*
506-
* @param WP_Connector_Registry $registry Connector registry instance.
507-
*/
508-
do_action( 'wp_connectors_init', $registry );
509480
}
510481

511482
/**

0 commit comments

Comments
 (0)