Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions backport-changelog/7.0/11564.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://github.com/WordPress/wordpress-develop/pull/11564
10 changes: 6 additions & 4 deletions lib/experimental/connectors/default-connectors.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,10 +373,9 @@ function _gutenberg_connectors_rest_settings_dispatch( WP_REST_Response $respons
* @access private
*/
function _gutenberg_register_default_connector_settings(): void {
$ai_registry = \WordPress\AiClient\AiClient::defaultRegistry();
$existing_settings = get_registered_settings();

foreach ( wp_get_connectors() as $connector_id => $connector_data ) {
foreach ( wp_get_connectors() as $connector_data ) {
$auth = $connector_data['authentication'];
if ( 'api_key' !== $auth['method'] || empty( $auth['setting_name'] ) ) {
continue;
Expand All @@ -387,8 +386,11 @@ function _gutenberg_register_default_connector_settings(): void {
continue;
}

// For AI providers, skip if the provider is not in the AI Client registry.
if ( 'ai_provider' === $connector_data['type'] && ! $ai_registry->hasProvider( $connector_id ) ) {
if ( ! isset( $connector_data['plugin']['is_active'] ) || ! is_callable( $connector_data['plugin']['is_active'] ) ) {
continue;
}

if ( ! call_user_func( $connector_data['plugin']['is_active'] ) ) {
continue;
}

Expand Down
Loading