Skip to content

Commit 633e59a

Browse files
Connectors: Respect custom setting_name in connector registration.
`WP_Connector_Registry::register()` always auto-generates the `setting_name` for connectors with `api_key` authentication, ignoring any caller-provided value. This prevents connectors from using existing WordPress options as their API key storage. This change checks for a non-empty `setting_name` in the provided args before falling back to the auto-generated name. Props jorgefilipecosta, gziolo. Fixes #64957. Built from https://develop.svn.wordpress.org/trunk@62116 git-svn-id: http://core.svn.wordpress.org/trunk@61398 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 parent 7c9dbc1 commit 633e59a

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

wp-includes/class-wp-connector-registry.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,11 @@ public function register( string $id, array $args ): ?array {
192192
if ( ! empty( $args['authentication']['credentials_url'] ) && is_string( $args['authentication']['credentials_url'] ) ) {
193193
$connector['authentication']['credentials_url'] = $args['authentication']['credentials_url'];
194194
}
195-
$connector['authentication']['setting_name'] = 'connectors_ai_' . str_replace( '-', '_', $id ) . '_api_key';
195+
if ( ! empty( $args['authentication']['setting_name'] ) && is_string( $args['authentication']['setting_name'] ) ) {
196+
$connector['authentication']['setting_name'] = $args['authentication']['setting_name'];
197+
} else {
198+
$connector['authentication']['setting_name'] = 'connectors_ai_' . str_replace( '-', '_', $id ) . '_api_key';
199+
}
196200
}
197201

198202
if ( ! empty( $args['plugin'] ) && is_array( $args['plugin'] ) ) {

wp-includes/version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* @global string $wp_version
1818
*/
19-
$wp_version = '7.0-RC1-62115';
19+
$wp_version = '7.0-RC1-62116';
2020

2121
/**
2222
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

0 commit comments

Comments
 (0)