Skip to content

Connectors: Stop auto-defaulting plugin.is_active in the registry#11701

Draft
t-hamano wants to merge 1 commit intoWordPress:trunkfrom
t-hamano:65020-update-is-active-check
Draft

Connectors: Stop auto-defaulting plugin.is_active in the registry#11701
t-hamano wants to merge 1 commit intoWordPress:trunkfrom
t-hamano:65020-update-is-active-check

Conversation

@t-hamano
Copy link
Copy Markdown
Contributor

@t-hamano t-hamano commented May 4, 2026

This PR backports the changes from Gutenberg to the core: WordPress/gutenberg#77897

Trac ticket: https://core.trac.wordpress.org/ticket/65020

Use of AI Tools

None


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

Previously, `WP_Connector_Registry::register()` silently filled in `__return_true` when no `is_active` callback was provided, which made it impossible for consumers to distinguish "no callback supplied" from "callback always returns true." Defer the check to call sites instead, so the stored connector data reflects what was actually registered.

Update `_wp_register_default_connector_settings()` and `_wp_connectors_get_connector_script_module_data()` to treat a missing callback as active, matching the documented `Defaults to __return_true` semantics.

See #65020.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

Test using WordPress Playground

The 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

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

Comment on lines -273 to -276
if ( ! isset( $connector['plugin']['is_active'] ) ) {
$connector['plugin']['is_active'] = '__return_true';
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove Defaults to __return_true. from line no 118

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants