Skip to content

Remove Enable AI header toggle - #985

Open
wprashed wants to merge 11 commits into
WordPress:developfrom
wprashed:fix/600-remove-enable-ai-header-toggle
Open

Remove Enable AI header toggle#985
wprashed wants to merge 11 commits into
WordPress:developfrom
wprashed:fix/600-remove-enable-ai-header-toggle

Conversation

@wprashed

@wprashed wprashed commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

What?

Closes #600

Removes the Enable AI header toggle from the AI settings page (routes/ai-home/stage.tsx), cleans up remaining globalEnabled UI disabling logic, and allows individual feature and experiment group toggles to directly control plugin functionality.

Why?

The Enable AI header toggle displayed a binary ON/OFF state that did not accurately reflect individual feature configurations. Per maintainer consensus in #600, this PR removes the global header toggle entirely, allowing individual feature toggles and category group toggles (or deactivating the plugin / using core filters) to manage functionality.

How?

  • Removed the Enable AI header <ToggleControl> and InfoTip from routes/ai-home/stage.tsx.
  • Removed unused globalToggleDescription, GLOBAL_FIELD_ID, noop, and DisabledToggle component from stage.tsx.
  • Removed globalEnabled prop and conditions from SectionActions and VisualCardToggle in stage.tsx, ensuring individual toggles and bulk action buttons remain interactive.
  • Removed .ai-showcase-card--disabled CSS rule from routes/ai-home/style.scss.
  • Updated is_globally_enabled() in includes/Abstracts/Abstract_Feature.php to default to true when option is not explicitly set.
  • Updated Playwright E2E helpers (tests/e2e/utils/helpers.ts) in disableExperiments and enableExperiments to wait for section action buttons to render before counting, correctly capture settings save responses, and toggle showcase cards.
  • Updated tests/e2e/specs/admin/settings.spec.js to assert section button states and removed the obsolete test for disabled global bulk actions.

Use of AI Tools

AI assistance: Yes
Tool(s): Antigravity
Model(s): Gemini 2.5 Pro
Used for: Diagnosing E2E test failures, updating settings UI components and E2E test assertions, and structuring the PR according to repository guidelines.

Testing Instructions

  1. Go to the AI settings page (options-general.php?page=ai-wp-admin).
  2. Confirm the header renders cleanly with Docs, Contribute, and options links, without the Enable AI header toggle.
  3. Confirm section group toggles ("Enable all" / "Disable all") and individual feature toggles are enabled and continue to work as expected.
  4. Verify that running npm run typecheck, npm run lint:js, and npm run build pass without errors.

Screenshots or screencast

Before After
Header includes "Enable AI" toggle Header has no "Enable AI" toggle; features are managed via section buttons and toggles

Changelog Entry

Removed - The Enable AI header toggle from the AI settings page.

Open WordPress Playground Preview

@wprashed
wprashed requested a review from a team August 30, 2026 07:08
@github-actions

github-actions Bot commented Aug 30, 2026

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.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @manueldiaz2006t-blip.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: manueldiaz2006t-blip.

Co-authored-by: wprashed <wprashed@git.wordpress.org>
Co-authored-by: dkotter <dkotter@git.wordpress.org>
Co-authored-by: jeffpaul <jeffpaul@git.wordpress.org>
Co-authored-by: andreilupu <euthelup@git.wordpress.org>
Co-authored-by: JasonTheAdams <jason_the_adams@git.wordpress.org>
Co-authored-by: gziolo <gziolo@git.wordpress.org>

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

@codecov

codecov Bot commented Aug 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.51%. Comparing base (62b1a5b) to head (e3cf1ae).

Additional details and impacted files
@@            Coverage Diff             @@
##             develop     #985   +/-   ##
==========================================
  Coverage      81.51%   81.51%           
  Complexity      2924     2924           
==========================================
  Files            122      122           
  Lines          11655    11655           
==========================================
  Hits            9500     9500           
  Misses          2155     2155           
Flag Coverage Δ
unit 81.51% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dkotter dkotter left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

E2E tests are failing here.

In addition, please ensure the PR description contains everything from our PR template, as already mentioned here

@jeffpaul jeffpaul added this to the 1.4.0 milestone Sep 3, 2026
*/
final public function is_globally_enabled(): bool {
return (bool) get_option( Settings_Registration::GLOBAL_OPTION, false );
return (bool) get_option( Settings_Registration::GLOBAL_OPTION, true );

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

So I've not tested things yet so I may be wrong but if someone currently has things set to be globally disabled, it seems like after this update there will be no way for them to actually enable things, since we're removing the UI.

So for new installs and existing installs that were already enabled, those should be fine. But existing installs that purposely disabled things, I think they'll be permanently stuck in that disabled state.

We use the result of this method in the is_enabled method and so that method will always return false in that scenario. And with no UI to enable things, the Settings_Registration::GLOBAL_OPTION value will never be updated.

Honestly not sure on the best approach here. We could change this method to always return true. We could remove this method all together. We could have an upgrade routine to set Settings_Registration::GLOBAL_OPTION to true. And probably other approaches as well I'm not thinking of right now

Comment thread routes/ai-home/stage.tsx
<>
<Stack align="center" gap="xs">
<ToggleControl
label={ __( 'Enable AI', 'ai' ) }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

So we remove the display of the setting here but we don't actually remove the registration of the setting in includes/Settings/Settings_Registration.php. Should we?

hasText: 'AI enabled.',
} )
).toBeVisible();
export const enableExperiments = async ( admin?: Admin, page?: Page ) => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Any reason to keep this? Since this does nothing now, thinking it would be better to just get rid of it

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.

Remove Enable AI header toggle, allow feature/experiment toggles (and group toggles) to control plugin functionality

3 participants