Skip to content

[issue-632] Add settings UI to toggle individual AI connector activation status#661

Open
farhanmaba wants to merge 5 commits into
WordPress:developfrom
farhanmaba:issue-632
Open

[issue-632] Add settings UI to toggle individual AI connector activation status#661
farhanmaba wants to merge 5 commits into
WordPress:developfrom
farhanmaba:issue-632

Conversation

@farhanmaba

@farhanmaba farhanmaba commented Jun 4, 2026

Copy link
Copy Markdown

What?

Closes #632

Introduces toggles for each active AI connector in the General AI Settings page to easily activate or deactivate individual connectors without losing their saved credentials (e.g. API keys) in the database.

Why?

Currently, users cannot deactivate an active AI connector without removing its API key or configuration completely. When testing multiple providers (like OpenAI and Google), deleting keys makes it inconvenient to switch back and forth.

By introducing administrative toggles, users can temporarily disable a specific connector from being used by the AI plugin, while retaining the configured credentials in the background for quick reactivation later.

How?

  1. Dynamic Setting Registration: Registered a REST-enabled setting wpai_connector_{$connector_id}_enabled for each active connector dynamically in Settings_Registration.php.
  2. Settings UI Pseudo-Features: Exposed active connectors under a new AI Connectors section at the top of the AI Settings page in Settings_Page.php. Each connector maps to its toggle setting automatically via the existing DataForm configuration.
  3. Connector Operations Integration: Modified has_connector_authentication(), is_connector_configured(), and get_ai_connectors() in helpers.php to respect the status of the toggle settings.
  4. Integration Testing: Added integration test suite checks in tests/Integration/Includes/HelpersTest.php to verify functionality.

Use of AI Tools

AI assistance: Yes
Tool(s): Antigravity
Model(s): Gemini Flash 3.5
Used for: Initial code skeleton and test suggestions; final implementation and tests were reviewed and edited by me.

Testing Instructions

  1. Ensure at least one AI connector plugin (e.g. Google or OpenAI) is active.
  2. Navigate to Settings > AI in the WordPress Admin Dashboard.
  3. Observe the new AI Connectors section at the top, listing the active connector(s) with an enabled toggle switch.
  4. Toggle the active connector to Disabled and save the settings.
  5. Verify that:
    • The settings screen displays the warning notice indicating that the AI plugin requires a valid connector.
    • The provider is no longer utilized for AI operations (e.g. blocks/experiments degrade gracefully or report no credentials).
  6. Toggle the connector back to Enabled and save settings. Verify the warning is cleared and the connector resumes functioning normally without having to re-enter any API keys.

Screenshots or screencast

Before After
No way to disable a connector except deleting the credentials. A dedicated "AI Connectors" card section renders at the top with a toggle for each active provider.

Changelog Entry

Added - Added toggle controls to deactivate and activate individual AI connectors without deleting their configuration or keys.

Open WordPress Playground Preview

@farhanmaba farhanmaba marked this pull request as draft June 4, 2026 09:19
@github-actions

github-actions Bot commented Jun 4, 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.

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

Co-authored-by: farhanmaba <farhansabirdynasign@git.wordpress.org>
Co-authored-by: pbearne <pbearne@git.wordpress.org>

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

@farhanmaba farhanmaba marked this pull request as ready for review June 4, 2026 09:56
@farhanmaba

Copy link
Copy Markdown
Author

This is ready :-)

@codecov

codecov Bot commented Jun 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.68%. Comparing base (64e8032) to head (3a36dde).

Files with missing lines Patch % Lines
includes/helpers.php 75.00% 2 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop     #661      +/-   ##
=============================================
+ Coverage      74.57%   74.68%   +0.10%     
- Complexity      1754     1757       +3     
=============================================
  Files             85       85              
  Lines           7548     7588      +40     
=============================================
+ Hits            5629     5667      +38     
- Misses          1919     1921       +2     
Flag Coverage Δ
unit 74.68% <95.00%> (+0.10%) ⬆️

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
Collaborator

Choose a reason for hiding this comment

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

I think we need more discussion on this before proceeding.

My suggestion is this is something that should be added upstream to WordPress itself, as we aren't responsible for the Connectors API within this plugin.

That said, we have taken the approach of experimenting here to try and prove out ideas that may make their way upstream. If we want that here, I'd suggest we try integrating within the Connectors screen (if possible) instead of introducing new settings within the AI plugin

@dkotter dkotter added this to the Future Release milestone Jun 4, 2026
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.

be enable to deactivate a connector and not lost settings

2 participants