Connectors: Respect custom setting_name in connector registration#11357
Connectors: Respect custom setting_name in connector registration#11357jorgefilipecosta wants to merge 1 commit intoWordPress:trunkfrom
Conversation
The `WP_Connector_Registry::register()` method 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.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
gziolo
left a comment
There was a problem hiding this comment.
We could add an unit test to cover this case later.
Summary
WP_Connector_Registry::register()always auto-generates thesetting_nameforapi_keyconnectors, ignoring any caller-provided value in$args['authentication']['setting_name']setting_namein the provided args before falling back to the auto-generated nameTrac ticket: https://core.trac.wordpress.org/ticket/64957
Test plan
setting_nameand verify it is preserved in the registry outputsetting_namestill get the auto-generated value