Skip to content

Support WordPress 7.0 core AI client integration#249

Closed
Jameswlepage wants to merge 3 commits intoWordPress:developfrom
Jameswlepage:feature/7-0-core-ai-compat
Closed

Support WordPress 7.0 core AI client integration#249
Jameswlepage wants to merge 3 commits intoWordPress:developfrom
Jameswlepage:feature/7-0-core-ai-compat

Conversation

@Jameswlepage
Copy link
Contributor

@Jameswlepage Jameswlepage commented Feb 20, 2026

Summary

This PR prepares the plugin for the WordPress 7.0 transition where the AI client is bundled in core.

What changed

  • Detects and supports core-provided AI client classes while retaining bundled compatibility.
  • Registers providers in a core-first way (with fallback handling for legacy/bundled classes).
  • Adds credential bridge logic so stored option credentials can be applied to the runtime provider registry.
  • Introduces compatibility wrappers for prompt calls used by abilities/services.
  • Reworks settings behavior to warn when credentials are missing/invalid instead of hard failing.
  • Adds helpers for environment/constant credential discovery.
  • Updates tests (including new bootstrap coverage) for core/bundled compatibility behavior.
  • Updates Composer dependencies for wp-ai-client and provider packages.

Why

WordPress 7.0 includes the AI client foundation but may not expose a credential settings UI in all builds. This keeps AI Experiments functional and fail-soft across 6.9 and 7.0 while improving forward compatibility.

Related

Testing

  • composer lint
  • composer phpstan
  • npm run test:php
Open WordPress Playground Preview

@Jameswlepage Jameswlepage mentioned this pull request Feb 20, 2026
"wordpress/wp-ai-client": "^0.3.0",
"wordpress/anthropic-ai-provider": "^1.0",
"wordpress/google-ai-provider": "^1.0",
"wordpress/openai-ai-provider": "^1.0"
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we should depend on any of these anymore?

Need to require WordPress >= 7.0-beta, and then it'll just work. For the providers, we could add a nag to install them, although very soon this will be in Core anyway.

* @param mixed $prompt Optional initial prompt content.
* @return mixed Prompt builder instance.
*/
function ai_client_prompt_with_wp_error( $prompt = null ) {
Copy link
Member

Choose a reason for hiding this comment

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

Why don't we go all in on requiring WP 7.0 instead? I think it makes sense. It'll mean users on production sites won't be able to update, but that's not really the objective at this point IMO. Going all in on 7.0 will makes this much simpler and prepare us for the future state we want this to be in. And once 7.0 stable is out, any site using an older version of this plugin already will be able to just update.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#242 (comment)

Seconded. Was aiming to get this to be "testable" for the current beta.

@dkotter
Copy link
Collaborator

dkotter commented Feb 20, 2026

Decent overlap between what's done here and what I did in #242. Is there any benefit to keeping #242 open or should we consolidate to just this PR?

@codecov
Copy link

codecov bot commented Feb 20, 2026

Codecov Report

❌ Patch coverage is 19.00826% with 294 lines in your changes missing coverage. Please review.
✅ Project coverage is 52.73%. Comparing base (4fbb197) to head (4f3be71).
⚠️ Report is 5 commits behind head on develop.

Files with missing lines Patch % Lines
includes/bootstrap.php 11.01% 202 Missing ⚠️
includes/Settings/Settings_Page.php 0.00% 39 Missing ⚠️
includes/helpers.php 65.62% 22 Missing ⚠️
includes/Abilities/Image/Generate_Image.php 0.00% 16 Missing ⚠️
...es/Abilities/Title_Generation/Title_Generation.php 0.00% 11 Missing ⚠️
...bilities/Excerpt_Generation/Excerpt_Generation.php 0.00% 1 Missing ⚠️
includes/Abilities/Image/Alt_Text_Generation.php 0.00% 1 Missing ⚠️
includes/Abilities/Image/Generate_Image_Prompt.php 0.00% 1 Missing ⚠️
includes/Abilities/Summarization/Summarization.php 0.00% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop     #249      +/-   ##
=============================================
- Coverage      56.69%   52.73%   -3.97%     
- Complexity       505      513       +8     
=============================================
  Files             32       32              
  Lines           2568     2890     +322     
=============================================
+ Hits            1456     1524      +68     
- Misses          1112     1366     +254     
Flag Coverage Δ
unit 52.73% <19.00%> (-3.97%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 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.

@jeffpaul
Copy link
Member

Closing in favor of #242.

@jeffpaul jeffpaul closed this Feb 23, 2026
@github-project-automation github-project-automation bot moved this from In progress to Done in WordPress AI Planning & Roadmap Feb 23, 2026
@jeffpaul
Copy link
Member

Confirming that everyone active here is already listed for props to come in #242 in #242 (comment).

@jeffpaul jeffpaul removed this from the 0.5.0 milestone Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

4 participants