Skip to content

Use WordPress 7.0 core AI client for Plugin Namer #1195

Merged
davidperezgar merged 9 commits intotrunkfrom
1192-fatal-error-with-wordpress-70-beta-2-using-core
Mar 4, 2026
Merged

Use WordPress 7.0 core AI client for Plugin Namer #1195
davidperezgar merged 9 commits intotrunkfrom
1192-fatal-error-with-wordpress-70-beta-2-using-core

Conversation

@davidperezgar
Copy link
Copy Markdown
Member

@davidperezgar davidperezgar commented Mar 1, 2026

Description

Fixes the fatal error when running Plugin Check on WordPress 7.0 beta 2 by removing the custom AI Connect integration and migrating Plugin Namer to WordPress core AI APIs.

Fixes #1192

Changes

  • Use core AI client
    Plugin Namer now uses wp_ai_client_prompt() and core-compatible prompt builder calls instead of the old AI Connect layer.

  • Official provider/model listing flow (core source aligned)
    Model listing now follows the same approach as the official source:

    • AiClient::defaultRegistry()
    • getRegisteredProviderIds()
    • isProviderConfigured( $provider_id )
    • modelMetadataDirectory()->listModelMetadata()
      Only configured providers are listed, and models are grouped by provider in the UI.
  • Remove plugin-level AI settings integration
    Removed:

    • includes/Admin/Settings_Page.php
    • includes/Traits/AI_Connect.php
    • assets/js/admin-settings.js
      AI configuration is handled in WordPress core settings/connectors only.
  • Namer availability and UX updates

    • Added core AI availability checks (wp_ai_client_prompt, WP 7.0+, text generation support).
    • If AI is unavailable/not configured, Namer shows guidance only (no input fields, no submit button).
    • Added a direct button to open connectors settings:
      wp-admin/options-general.php?page=connectors-wp-admin.
  • Plugin registration cleanup

    • Plugin_Main no longer registers the removed Settings page.
  • Documentation update

    • readme.txt now states Plugin Namer requires WordPress 7.0+ with configured core AI connectors.
  • Dependencies/config

    • Removed AI client package dependency from composer.json/composer.lock related to the old integration.
    • Updated PHPMD handling to match the refactor and keep checks green.

Benefits

  • Removes WP 7.0 beta 2 fatal error path.
  • Aligns Plugin Namer with WordPress core AI architecture.
  • Avoids duplicated provider/key settings inside Plugin Check.
  • Uses the official configured-provider model listing behavior.
  • Provides clear fallback UX when connectors are unavailable.

Testing Instructions

  1. Check out this branch and activate Plugin Check in WP 7.0 beta 2+.
  2. Open Tools → Plugin Check and confirm no fatal errors.
  3. Open Tools → Plugin Check Namer and verify:
    • With configured connectors: form is visible, provider-grouped model select is populated, name evaluation works.
    • Without configured connectors: advice-only view is shown (no fields/button), with a button to open connectors settings.
  4. On WordPress < 7.0, open Tools → Plugin Check Namer and confirm requirement messaging appears without fatals.
  5. Run:
    • composer lint
    • composer phpmd
    • composer phpstan (if applicable)

Checklist

  • Code follows WordPress Coding Standards
  • Self-reviewed the code
  • No new linter errors
  • Verified composer phpmd passes

@davidperezgar davidperezgar linked an issue Mar 1, 2026 that may be closed by this pull request
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 1, 2026

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: davidperezgar <davidperez@git.wordpress.org>
Co-authored-by: ernilambar <nilambar@git.wordpress.org>
Co-authored-by: frantorres <frantorres@git.wordpress.org>
Co-authored-by: jonathanbossenger <psykro@git.wordpress.org>
Co-authored-by: threadi <threadi@git.wordpress.org>

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

@jonathanbossenger
Copy link
Copy Markdown

Testing notes

Installed PCP on a WordPress version older than 7.0:

  • ✅ The Settings page is not displayed in the menu
  • On the Plugin Check Namer page, the Configure AI Connectors button appears.

Upgraded to WordPress 7.0 beta 2:

  • On the Plugin Check Namer page, the Plugin Name, Author Name, and AI Model selection fields are shown, even though I haven't configured a connector
  • Attempted to add the Anthropic connector, but was unable to save the API Key. I had to disable PCP to be able to add the connector.
  • Added the Anthropic connector, reactivated PCPC. On the Plugin Check Namer page, I can't select the Model
  • Attempting to check a name, the Ajax request responds with "No models found that support text_generation for this prompt"
  • Checking the connectors page, and it appears my Anthropic connector is not connected anymore. Disabling PCP and the connector shows as connected.

@davidperezgar
Copy link
Copy Markdown
Member Author

Thanks for the feedback. I've updated and I think is ready.

@davidperezgar davidperezgar requested a review from felixarntz March 2, 2026 17:44
@ernilambar ernilambar added this to the 1.9.0 milestone Mar 4, 2026
@davidperezgar davidperezgar merged commit bb43607 into trunk Mar 4, 2026
28 checks passed
@davidperezgar davidperezgar deleted the 1192-fatal-error-with-wordpress-70-beta-2-using-core branch March 4, 2026 21:47
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.

Fatal Error with WordPress 7.0 Beta 2

4 participants