Skip to content

Add a warning when plugins integrate directly with AI providers instead of using the WordPress AI Client #1341

@davidperezgar

Description

@davidperezgar

Problem

WordPress 7.0 introduces the AI Client and Connectors infrastructure. Plugins can use wp_ai_client_prompt() to send prompts through the site owner’s configured AI provider instead of integrating directly with provider APIs or SDKs.

Plugin Check should help plugin authors discover this new recommended path when their plugin appears to connect directly to AI providers such as OpenAI, Anthropic, Google/Gemini, Grok, or similar services.

Why this check is needed

Direct AI integrations are not always invalid, but WordPress now provides a standard abstraction for many AI use cases. A Plugin Check warning would help authors modernize their integrations and avoid unnecessary provider-specific code.

This matters because:

  • Site owners can configure AI providers once through WordPress Connectors.
  • Plugins can work with whichever compatible provider the site owner has configured.
  • Plugins can avoid duplicating provider setup screens, API key fields, and credential storage.
  • The WordPress AI Client provides a consistent API and WordPress-style error handling.

Proposed behavior

Add a warning/recommendation when Plugin Check detects direct AI provider integrations, such as:

wp_remote_post( 'https://api.openai.com/v1/chat/completions', ... );

or bundled provider SDKs in composer.json.

This should not be a hard failure. The check should recommend considering the WordPress AI Client where it fits the plugin’s use case.

Suggested message

Your plugin appears to integrate directly with a third-party AI provider. Since WordPress 7.0, plugins are encouraged to use the WordPress AI Client and Connectors infrastructure where possible. This lets the site owner configure their preferred provider once in WordPress, while plugins can send prompts through a standard API without managing provider credentials directly.

Consider replacing direct provider calls with wp_ai_client_prompt() when the WordPress AI Client supports your use case.

Example

$text = wp_ai_client_prompt( 'Summarize this post.' )
	->generate_text();

if ( is_wp_error( $text ) ) {
	return $text;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    ChecksAudit/test of the particular part of the plugin[Team] PluginsIssues owned by Plugins Team

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions