The WordPress 7.0 AI client from a developer's perspective

The WordPress 7.0 AI client in a developer deep-dive: API architecture, code examples, feature detection and what this means for existing plugins. From a plugin developer who's been at it since 2009.

This article was last updated on March, 28 2026.

info
Written by Saskia Teichmann
on March 28, 2026
Sending
User Review
5 (1 vote)
Comments Rating 0 (0 reviews)
WordPress 7.0 AI Client: Technische Analyse für Plugin-Entwickler | isla stud.io

WordPress 7.0 brings a built-in AI client. Not as a plugin, not as an experimental feature flag, but as part of the core. That is a statement.

I have been developing WordPress plugins since 2009 and have worked with citelayer® I built an AI plugin myself that is directly affected by this architectural decision. Here is my technical analysis: What can the API do, what are its strengths, and what do plugin developers need to know?

The Entry Point: wp_ai_client_prompt()

It all starts with a single function:

$builder = wp_ai_client_prompt();

This gives a WP_AI_Client_Prompt_Builder-object - a Fluent Builder via which the prompt, configuration and generation method are linked. The basic principle: The developer describes, what he needs. WordPress takes care of the how.

A simple example of text generation:

// Prompt directly as a parameter - convenient for simple cases
$text = wp_ai_client_prompt( 'Summarize the benefits of caching in WordPress.' )
    ->using_temperature( 0.7 )
    ->generate_text();

// Error handling as everywhere in WordPress: Check WP_Error
if ( is_wp_error( $text ) ) {
    return;
}

echo wp_kses_post( $text );

The prompt text can be set as a parameter or via with_text() can be set - the latter is useful if the prompt is assembled dynamically.

More than text: Image, language, video

The API is multimodal. Image generation works according to the same pattern:

use WordPress\AiClient\Files\DTO\File;

$image = wp_ai_client_prompt( 'A futuristic WordPress logo in neon style' )
    ->generate_image();

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

// File DTO with Data URI - directly usable
echo '<img src="' . esc_url( $image->getDataUri() ) . '" data-no-translation="" data-no-auto-translation="">';

For variations there are generate_images( 4 ) and generate_texts( 4 ). In addition convert_text_to_speech_result(), generate_speech_result() and generate_video_result(). WordPress covers all common modalities.

Particularly exciting: multimodal output in a single request:

use WordPress\AiClient\Messages\Enums\ModalityEnum;

// Text and images in one response - the result contains both
$result = wp_ai_client_prompt( 'Create a recipe with photos for each step.' )
    ->as_output_modalities( ModalityEnum::text(), ModalityEnum::image() )
    ->generate_result();

This opens the door to plugins that generate content that goes beyond pure text.

Feature Detection: Do not make any assumptions

Not every WordPress installation will have an AI provider configured. And not every provider supports every modality. The API offers deterministic checks:

$builder = wp_ai_client_prompt( 'test' )
    ->using_temperature( 0.7 );

// No API call - purely logical check against available providers
if ( $builder->is_supported_for_text_generation() ) {
    // Display UI for text generation
}

if ( $builder->is_supported_for_image_generation() ) {
    // Show image generation button
}

It's a clean solution. The checks cost nothing - no API calls, no latency. Plugin developers can load their UI conditionally and show a helpful hint if no AI is available. The rule: Never assume that AI features will work just because WordPress 7.0 is installed.

Available checks: is_supported_for_text_generation(), is_supported_for_image_generation(), is_supported_for_text_to_speech_conversion(), is_supported_for_speech_generation(), is_supported_for_video_generation().

Model preferences instead of requirements

The design philosophy becomes clear here:

$result = wp_ai_client_prompt( 'Explain the history of printing.' )
    ->using_temperature( 0.1 )
    ->using_model_preference(
        'claude-sonnet-4-6',
        'gemini-3.1-pro-preview',
        'gpt-5.4'
    )
    ->generate_text_result();

using_model_preference() is a Preference, no requirement. The AI client takes the first available model from the list - or any compatible one if none is configured. The plugin code always works, regardless of the provider.

This is the right decision. Plugin developers should never depend on a specific model being available. The official recommendation is to sort your models so that newer ones come before older ones. The three official provider plugins for the launch already do this.

Structured responses with JSON schema

This is a highlight for plugins that require structured data - and there are many of them:

$schema = array(
    'type' => 'array',
    'items' => array(
        'type' => 'object',
        'properties' => array(
            'plugin_name' => array( 'type' => 'string' ),
            'category' => array( 'type' => 'string' ),
        ),
        'required' => array( 'plugin_name', 'category' ),
    ),
);

$json = wp_ai_client_prompt( 'List 5 popular WordPress plugins with category.' )
    ->as_json_response( $schema )
    ->generate_text();

// Structured data directly as an array - no manual parsing required
$data = json_decode( $json, true );

This is worth its weight in gold for SEO plugins, form plugins and content analysis tools. Instead of parsing unstructured text, you get directly usable data.

The two-layer architecture

Under the hood, the AI Client consists of two levels:

  1. PHP AI Client (wordpress/php-ai-client) - a provider-agnostic PHP SDK, bundled as an external library in Core. CamelCase methods, exceptions, technically WordPress-independent.
  2. WordPress WrapperWP_AI_Client_Prompt_Builder develops the SDK in WordPress conventions: snake_case methods, WP_Error instead of exceptions, integration with WordPress HTTP Transport, Abilities API, Connectors infrastructure and the hook system.

This is an elegant separation. The PHP SDK can theoretically also be used outside of WordPress. The WordPress wrapper makes it idiomatic. And that GenerativeAiResult-object can be serialized and can be connected directly to rest_ensure_response() REST API integration out of the box:

function my_rest_callback( WP_REST_Request $request ) {
    $result = wp_ai_client_prompt( $request->get_param( 'prompt' ) )
        ->generate_text_result();

    // WP_Error oder GenerativeAiResult — beides funktioniert
    return rest_ensure_response( $result );
}

Granular control: The filter

For security and compliance there are wp_ai_client_prevent_prompt:

add_filter(
    'wp_ai_client_prevent_prompt',
    function ( bool $prevent, WP_AI_Client_Prompt_Builder $builder ): bool {
        // Example: AI for admins only
        if ( ! current_user_can( 'manage_options' ) ) {
            return true;
        }
        return $prevent;
    },
    10,
    2
);

If a prompt is blocked: no API call, is_supported_*() gives false back, generate_*() supplies WP_Error. Clean, predictable, no race conditions.

Strengths and weaknesses

Which is a good solution:

  • The provider abstraction. Plug-in developers never have to deal with API keys, rate limits or provider peculiarities.
  • Feature detection without API calls. No guessing whether something works.
  • The WordPress conventions. WP_Error, hooks, REST compatibility - it feels native.
  • JSON schema support. Structured responses are supported first class.
  • The two-tier architecture. Clean separation between SDK and WordPress integration.

What I observe critically:

  • The site owner is responsible for the connector configuration. Plugins have no influence on this, whether a provider is configured. Feature Detection catches this, but the UX challenge remains.
  • The model landscape is moving fast. It remains to be seen how well the preference list will age when new models appear every three months.
  • Performance implications are still unclear. How does the system behave under load when 10 plugins send prompts at the same time?

What this means for existing plugins

Every plugin that currently has its own AI integrations is faced with a decision: Keep your own API connection or migrate to the AI client?

For SEO plugins the answer is clear - structured data, content analysis and meta description generation run much more cleanly via the AI client. For Form plugins opens up intelligent field validation and auto-fill. For E-commerce plugins AI-generated product descriptions suddenly become trivial.

For a plugin like citelayer® - AI Visibility for WordPress, which works at the interface between WordPress and AI systems, the AI client is a natural extension. Citelayer makes content readable for AI - through llms.txt, schema injection, bot tracking and protocols such as UCP and WebMCP. The AI Client could supplement these analysis layers with more intelligent, AI-supported evaluations. I have explained what this means in concrete terms for AI Visibility in more detail in the Citelayer blog.

Not a gadget but infrastructure

The WordPress 7.0 AI Client is not a gadget. It is infrastructure. Well thought-out, WordPress-idiomatic, and with a clear design philosophy: the developer describes the intention, the system takes care of the execution.

Anyone developing WordPress plugins today should familiarize themselves with this API. Not because you have to - but because it is the foundation on which the next generation of WordPress plugins will be built.

The complete API documentation is available on the WordPress Make Blog.

<span class="castledown-font">Saskia Teichmann</span>

Saskia Teichmann

Saskia Teichmann is a certified AI expert (MMAI®), soon to be a member of the German AI Association, as well as a WooCommerce specialist and WordPress developer. She supports small and medium-sized businesses and industry in integrating AI, GDPR, EU AI regulations, and modern web technologies into a sustainable, legally compliant digital strategy.

To put it simply:
As a technical reality translator, she works at the interface of AI, web development and operational reality. She develops AI-supported workflows for companies and agencies - with the aim of ensuring that technology not only impresses in the demo, but also works in everyday life.

Submit a project requestServing coffee

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Sending