[wp-trac] [WordPress Trac] #64957: Connectors: `WP_Connector_Registry::register()` ignores custom `setting_name`

WordPress Trac noreply at wordpress.org
Wed Apr 1 16:38:04 UTC 2026


#64957: Connectors: `WP_Connector_Registry::register()` ignores custom
`setting_name`
-------------------------------------------------+-------------------------
 Reporter:  jorgefilipecosta                     |       Owner:
                                                 |  jorgefilipecosta
     Type:  defect (bug)                         |      Status:  closed
 Priority:  high                                 |   Milestone:  7.0
Component:  General                              |     Version:  trunk
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  has-patch dev-reviewed has-unit-     |     Focuses:
  tests                                          |
-------------------------------------------------+-------------------------
Changes (by jorgefilipecosta):

 * status:  reopened => closed
 * resolution:   => fixed


Comment:

 In [changeset:"62194" 62194]:
 {{{
 #!CommitTicketReference repository="" revision="62194"
 Connectors: Fix and generalize the API for custom connector types.

 Validate `setting_name`, `constant_name`, and `env_var_name` in connector
 registration — reject invalid values with `_doing_it_wrong()` instead of
 silently falling back.
 Change the auto-generated `setting_name` pattern from
 `connectors_ai_{$id}_api_key` to `connectors_{$type}_{$id}_api_key` so it
 works for any connector type. Built-in AI providers infer their names
 using
 the existing `connectors_ai_{$id}_api_key` convention, preserving backward
 compatibility.
 Add `constant_name` and `env_var_name` as optional authentication fields,
 allowing connectors to declare explicit PHP constant and environment
 variable names for API key lookup. AI providers auto-generate these using
 the `{CONSTANT_CASE_ID}_API_KEY` convention.
 Refactor `_wp_connectors_get_api_key_source()` to accept explicit
 `env_var_name` and `constant_name` parameters instead of deriving them
 from
 the provider ID. Environment variable and constant checks are skipped when
 not provided.
 Generalize REST dispatch, settings registration, and script module data to
 work with all connector types, not just `ai_provider`. Settings
 registration skips already-registered settings. Non-AI connectors
 determine
 `isConnected` based on key source.
 Replace `isInstalled` with `pluginFile` in script module data output to
 fix
 plugin entity ID resolution on the frontend.
 Update PHPDoc to reflect current behavior — widen `type` from literal
 `'ai_provider'` to `non-empty-string`, document new authentication fields,
 and use Anthropic examples throughout.

 Props gziolo, jorgefilipecosta.
 Fixes #64957.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64957#comment:13>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list