Skip to content

Add beta feature settings for datastore, ACF AI, schema - #539

Closed
faisalahammad wants to merge 1 commit into
WordPress:trunkfrom
faisalahammad:enhancement/433-beta-feature-settings
Closed

faisalahammad wants to merge 1 commit into
WordPress:trunkfrom
faisalahammad:enhancement/433-beta-feature-settings

Conversation

@faisalahammad

Copy link
Copy Markdown
Contributor

Adds three new entries to the Beta Features admin page so the features that currently require a PHP filter can be enabled by an administrator from wp-admin:

  • Enable Datastore (acf/settings/enable_datastore)
  • Enable ACF AI (acf/settings/enable_acf_ai)
  • Enable Schema Support (acf/settings/enable_schema)

Each feature gets a class under includes/admin/beta-features/ following the existing editor sidebar pattern, and register_beta_features() now registers them. A small globally loaded file, includes/beta-features.php, bridges each stored option to its runtime filter with OR semantics, so existing PHP filters keep working alongside the new toggles and a later filter callback can still override the stored option. The bridge is included during normal plugin bootstrap (not admin-only) because these settings also affect frontend and REST execution.

The uninstall routine now deletes all four beta feature options.

Closes #433

Use of AI Tools

This pull request was written with AI tooling assistance (Claude Code) and reviewed and tested by me.

@github-actions

Copy link
Copy Markdown

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 props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props faisalahammad, cbravobernal.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@faisalahammad
faisalahammad force-pushed the enhancement/433-beta-feature-settings branch from ac4e870 to 74070e5 Compare August 22, 2026 10:29
@cbravobernal

Copy link
Copy Markdown
Contributor

We do have already this done from ACF, don't we?

@faisalahammad

Copy link
Copy Markdown
Contributor Author

@cbravobernal ACF has the same features, but in ACF they are only on with a PHP filter (acf/settings/enable_acf_ai, acf/settings/enable_schema, acf/settings/enable_datastore). ACF has no admin toggle for them, up to 6.8.10. SCF ported the same code, so SCF also needs the filter today.

This PR adds the toggles to the Beta Features page, as asked in #433. The filters still work the same way. The toggle is one more way to turn each feature on.

I also merged the latest trunk into this branch.

@cbravobernal

Copy link
Copy Markdown
Contributor

@faisalahammad I merged the fix you did on e2e. Please update with trunk again ( rebase preferred ).
Thanks for the additional info, I've been on leave for a long time and completely forgot about this issue 😅 .

Expose enable_datastore, enable_acf_ai, and enable_schema as
toggles on the Beta Features admin page. A globally loaded
bridge maps each stored toggle to its existing runtime filter,
so PHP filters keep working alongside the new settings.

Fixes WordPress#433
@faisalahammad
faisalahammad force-pushed the enhancement/433-beta-feature-settings branch from 86d5c67 to ee40257 Compare October 26, 2026 20:47
@faisalahammad

Copy link
Copy Markdown
Contributor Author

@cbravobernal I rebased the branch on the latest trunk. It is now one commit on top of trunk, with no merge commit. The PR code did not change. The rebase also brings in your e2e fix from #572, so the WP trunk e2e shard should pass now.

@cbravobernal

Copy link
Copy Markdown
Contributor

Thanks for this! I tested it locally (wp-env, block editor). The PHP tests and phpcs pass, and the toggles save and switch the runtime settings on and off as expected. A few things to change before merging:

1. Please drop the "Move Elements to Editor Sidebar" registration.
This PR re-registers SCF_Admin_Beta_Feature_Editor_Sidebar, so the toggle shows up on the Beta Features page again. The feature itself no longer exists: the class only sets a name, title and description, and nothing in the plugin reads scf_beta_feature_editor_sidebar_enabled. Its registration was removed on purpose in #176. Checking it would do nothing, so please remove the acf_include() and register_beta_feature() lines for it, and update the test setup that depends on it.

2. "Enable ACF AI" and "Enable Schema Support" have nothing behind them.
enable_acf_ai and enable_schema are defined as settings with a false default, but nothing in the codebase reads them, so these toggles currently have no effect. I'd leave them out until there's functionality behind them.

3. Enabling "Datastore" loses field edits in the block editor.
With the datastore on, the datastore script loads and is populated correctly, but editing a field in a meta box and saving the post shows "Post updated" while the new value is never persisted: after a reload the old value is back. The same happens on trunk when the datastore is enabled via the acf/settings/enable_datastore filter, so this isn't caused by this PR. The datastore listens for the change_field action, but nothing dispatches it when a field changes (see fieldsEventManager.onChange in assets/src/js/_acf-fields.js), and the meta box save path is skipped while the datastore is on. Since this PR would expose that bug behind a one-click admin toggle, I'd hold off on the Datastore toggle until that's fixed separately.

@cbravobernal

Copy link
Copy Markdown
Contributor

Thanks for the work here! 🙏 The datastore and AI features this wraps are part of the code we keep in sync with an upstream codebase, so adding SCF-only settings around them would make future syncs harder. We keep that code identical to the upstream source. I'll close this one for now. If you'd like to propose a feature, please open an issue first so we can agree on scope and where it should live. Thanks again!

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.

Enable all features that require a filter into Beta Features admin section.

2 participants