[wp-trac] [WordPress Trac] #64960: Connectors: Allow custom env var and constant names for API key source detection
WordPress Trac
noreply at wordpress.org
Tue Mar 31 15:52:23 UTC 2026
#64960: Connectors: Allow custom env var and constant names for API key source
detection
------------------------------+---------------------
Reporter: jorgefilipecosta | Owner: (none)
Type: task (blessed) | Status: new
Priority: high | Milestone: 7.0
Component: AI | Version:
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
------------------------------+---------------------
Comment (by huzaifaalmesbah):
## Patch Testing Report
Patch Tested: https://github.com/WordPress/wordpress-develop/pull/11363
=== Environment
- WordPress: 7.0-RC2-62153-src
- PHP: 8.3.30
- Server: nginx/1.29.6
- Database: mysqli (Server: 8.4.8 / Client: mysqlnd 8.3.30)
- Browser: Chrome 146.0.0.0
- OS: macOS
- Theme: Twenty Thirteen 4.5
- MU Plugins:
* Ticket 64960 Test - Custom Key Source Detection 1.0
- Plugins:
* Query Monitor 3.20.4
* Test Reports 1.2.1
=== Steps taken
1. Registered a connector with custom `constant_name => 'MY_SERVICE_KEY'`
2. Defined constant `define( 'MY_SERVICE_KEY', 'sk-test-123' )`
3. Checked `keySource` detection via `_wp_connectors_get_api_key_source()`
4. Verified backward compatibility with default naming
5. ✅ Patch is solving the problem
=== Expected result
- Connector with custom `constant_name` should detect the constant and
return `keySource: 'constant'`
- Connector with custom `env_var_name` should detect the env var and
return `keySource: 'env'`
- Default naming convention should continue working.
=== Additional Notes
- Maybe fix already exists in trunk via commit
[https://github.com/WordPress/wordpress-develop/commit/54624070b4
54624070b4]
- PR [https://github.com/WordPress/wordpress-develop/pull/11363 #11363]
has merge conflicts because trunk already contains the fix
- Applying this patch on 7.0 branch resolves the issue
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64960#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list