wp-includes/class-wp-connector-registry.php:149Registers a new connector.
$idstring$argsarray$namestring
$descriptionstringdefault: empty string
$logo_urlstring
$typestring
$authenticationarray
$methodstring
$credentials_urlstring
$settingstring
connectors</em>{$type}_{$id}_api<em>keyfor API keys andconnectors</em>{$type}_{$id}_application_password for application passwords. Must be a non-empty string when provided. @type string $constant_name Optional. PHP constant name for the API key (e.g. 'ANTHROPIC_API_KEY') or for application-password credentials inusername:passwordformat. Only checked when provided. @type string $env_var_name Optional. Environment variable name for the API key (e.g. 'ANTHROPIC_API_KEY') or for application-password credentials inusername:passwordformat. Only checked when provided. } @type array $plugin { Optional. Plugin data for install/activate UI. @type string $file Optional. The plugin's main file path relative to the plugins directory (e.g. 'my-plugin/my-plugin.php' or 'hello.php'). @type callable $is_active Optional callback to determine whether the plugin is active. Receives no arguments and must return bool. Defaults to__return_true. }array|null public function register( string $id, array $args ): ?array { if ( ! preg_match( '/^[a-z0-9_-]+$/', $id ) ) { _doing_it_wrong( __METHOD__, __( 'Connector ID must contain only lowercase alphanumeric characters, hyphens, and underscores.' ), '7.0.0' ); return null; } if ( $this->is_registered( $id ) ) { _doing_it_wrong( __METHOD__, /* translators: %s: Connector ID. */ sprintf( __( 'Connector "%s" is already registered.' ), esc_html( $id ) ), '7.0.0' ); return null; } // Validate required fields. if ( empty( $args['name'] ) || ! is_string( $args['name'] ) ) { _doing_it_wrong( __METHOD__, /* translators: %s: Connector ID. */ sprintf( __( 'Connector "%s" requires a non-empty "name" string.' ), esc_html( $id ) ), '7.0.0' ); return null; } if ( empty( $args['type'] ) || ! is_string( $args['type'] ) ) { _doing_it_wrong( __METHOD__, /* translators: %s: Connector ID. */ sprintf( __( 'Connector "%s" requires a non-empty "type" string.' ), esc_html( $id ) ), '7.0.0' ); return null; } if ( ! isset( $args['authentication'] ) || ! is_array( $args['authentication'] ) ) { _doing_it_wrong( __METHOD__, /* translators: %s: Connector ID. */ sprintf( __( 'Connector "%s" requires an "authentication" array.' ), esc_html( $id ) ), '7.0.0' ); return null; } if ( empty( $args['authentication']['method'] ) || ! in_array( $args['authentication']['method'], array( 'api_key', 'application_password', 'none' ), true ) ) { _doing_it_wrong( __METHOD__, /* translators: %s: Connector ID. */ sprintf( __( 'Connector "%s" authentication method must be "api_key", "application_password", or "none".' ), esc_html( $id ) ), '7.0.0' ); return null; } if ( 'ai_provider' === $args['type'] && ! wp_supports_ai() ) { // No need for a `doing_it_wrong` as AI support is disabled intentionally. return null; } $connector = array( 'name' => $args['name'], 'description' => isset( $args['description'] ) && is_string( $args['description'] ) ? $args['description'] : '', 'type' => $args['type'], 'authentication' => array( 'method' => $args['authentication']['method'], ), ); if ( ! empty( $args['logo_url'] ) && is_string( $args['logo_url'] ) ) { $connector['logo_url'] = $args['logo_url']; }Introduced in 7.0.0. Unchanged from 7.0.4 through 7.1.0.
Signature, return type and hooks compared across 2 parsed releases.
src/wp-includes/class-wp-connector-registry.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.