Skip to content

Respect wp_supports_ai() and improve AI-disabled notice in Namer#1243

Open
raftaar1191 wants to merge 6 commits intoWordPress:trunkfrom
raftaar1191:fix/1222-respect-wp-supports-ai
Open

Respect wp_supports_ai() and improve AI-disabled notice in Namer#1243
raftaar1191 wants to merge 6 commits intoWordPress:trunkfrom
raftaar1191:fix/1222-respect-wp-supports-ai

Conversation

@raftaar1191
Copy link
Copy Markdown
Contributor

@raftaar1191 raftaar1191 commented Mar 27, 2026

What?

Closes #1222

This PR updates the Plugin Check Namer flow to respect WordPress AI support controls and present clearer UI messaging when AI functionality is unavailable.

Why?

The Namer tool should not initialize AI-dependent behavior when AI is disabled at the site level (for example via WP_AI_SUPPORT or the wp_supports_ai filter). This aligns Plugin Check with core AI capability controls and avoids confusing behavior for site administrators.

How?

  • Refactors AI readiness checks in AI_Utils into dedicated methods:
    • check_ai_prerequisites()
    • check_ai_connectors()
    • get_ai_config() as orchestrator
  • Adds an explicit wp_supports_ai() prerequisite check (when available) and returns a specific WP_Error when AI is disabled.
  • Keeps connector checks separate so UI can decide whether to show the “Configure AI Connectors” CTA only when prerequisites are met but connectors are missing.
  • Updates Namer page rendering to show the concrete prerequisite/connector error message and conditionally show connector setup action.

Use of AI Tools

I used GitHub Copilot (GPT-5.3-Codex) to assist with drafting/refactoring code and preparing the PR text. I reviewed and validated the final changes manually.

Testing Instructions

  1. Install and activate Plugin Check on a WordPress 7.0+ site.
  2. Visit Tools → Plugin Check Namer.
  3. Confirm normal behavior with AI support enabled and a connector configured.
  4. Disable AI support (for example by filtering wp_supports_ai to false).
  5. Reload the Namer page and verify an error notice appears indicating AI support is disabled.
  6. Re-enable AI support but remove/disable AI connectors.
  7. Reload the Namer page and verify connector-related guidance appears with a Configure AI Connectors button.
  8. Run PHPCS on the changed files and confirm no new violations.

Testing Instructions for Keyboard

  1. Navigate to Tools → Plugin Check Namer using keyboard only.
  2. Verify focus order reaches the notice and action button when shown.
  3. Activate the Configure AI Connectors button using keyboard (Enter/Space) and confirm navigation works.

Screenshots or screencast

PR.proof.for.1222.mp4

@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.

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: raftaar1191 <raftaar1191@git.wordpress.org>

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

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.

Respect wp_supports_ai() and show notice if AI functionality is disabled in Plugin Check Namer

1 participant