14+ years building on WordPress / Replies in under 5 hours
AI & Technology 9 min read · Updated July 2026

The WordPress Abilities API: A Developer’s Guide to AI-Powered Blocks

AK
Ajay Khandal
WordPress Developer
The WordPress Abilities API: The New Core for AI-Powered Blocks
TL;DR

The WordPress Abilities API is a standardised interface that lets Gutenberg blocks declare and invoke AI capabilities — text generation, summarisation, translation, sentiment analysis — without directly integrating with a specific AI model or managing API keys at the block level. Blocks declare their required Abilities in block.json using an "abilities" key; at runtime they call wp.abilities.request('ability-name', { context }) which returns a Promise resolving to the AI response. WordPress handles model routing, authentication, rate limiting, and error normalisation centrally. This makes block AI features model-agnostic: switching from one language model to another requires no changes to block code — only the site-level Ability configuration changes. The API integrates with Gutenberg Phase 3 collaborative features, allowing AI agents to participate in editing sessions through the same registered Ability interface.

Before the Abilities API, adding AI to a WordPress block meant every plugin did it differently. One plugin called OpenAI directly with its own bundled API key management. Another shipped its own LLM SDK. A third made raw fetch() calls to an external endpoint with authentication handled in JavaScript — visible to anyone who opened DevTools. The result: five AI-powered plugins on a site meant five different authentication schemes, five JavaScript bundles, and five different failure modes.

The Abilities API solves this at the architecture level. It’s a standardised interface between the block layer and AI models — a single place where Abilities are registered, authenticated, rate-limited, and served to any block that declares a need for them. Blocks don’t know which model they’re talking to. They request an Ability by name, pass context, and get a result.

This is what “model-agnostic” means in practice: change the underlying model from the WordPress admin panel, and every block that uses that Ability automatically uses the new model — without touching a line of block code.

What the Abilities API Actually Is

The Abilities API is a core WordPress framework with three layers:

1. The registry. A central server-side store of named Abilities — summarize, translate, tone-adjust, generate-alt-text, and any custom Abilities your theme or plugin registers. Each registered Ability declares: what AI model handles it, what input schema it accepts, what output format it returns, and what rate limits apply.

2. The block declaration. Blocks declare which Abilities they need in block.json. This is a static declaration — WordPress validates it at block registration time and won’t activate a block’s AI features if its required Abilities aren’t available.

3. The JavaScript API. In block edit/save scripts, wp.abilities.request() sends an Ability invocation to the WordPress REST endpoint that handles routing to the appropriate model. The block never sees API keys, never handles authentication, and never needs to know which model is active.

Compare this to the approach the WordPress Interactivity API guide describes for reactive UI — the Abilities API handles the AI side with the same philosophy: declarative at the block level, implementation handled by WordPress core.

Declaring Abilities in block.json

The block.json declaration is where a block announces what AI capabilities it needs:

{
  "name": "my-plugin/smart-summary",
  "title": "Smart Summary",
  "description": "Auto-generates a TL;DR from post content using the Abilities API.",
  "category": "text",
  "attributes": {
    "summary": {
      "type": "string",
      "default": ""
    }
  },
  "abilities": {
    "required": ["summarize"],
    "optional": ["translate"]
  },
  "editorScript": "file:./edit.js",
  "viewScript": "file:./view.js"
}

The "abilities" key takes required (block won’t function without this Ability) and optional (block degrades gracefully if the Ability isn’t available). WordPress validates this at registration and surfaces a notice in the editor if a required Ability is missing from the site’s registry.

Calling Abilities from Block JavaScript

In your block’s edit.js, wp.abilities.request() is the entry point. It returns a Promise that resolves to the model’s response, normalised to the output schema the Ability declared:

import { useBlockProps, RichText } from '@wordpress/block-editor';
import { Button } from '@wordpress/components';
import { useState } from '@wordpress/element';

export default function Edit( { attributes, setAttributes, context } ) {
    const blockProps = useBlockProps();
    const [ isLoading, setIsLoading ] = useState( false );

    async function generateSummary() {
        setIsLoading( true );
        try {
            const result = await wp.abilities.request( 'summarize', {
                content: context.postContent,
                maxLength: 150,
                format: 'plain',
            } );
            setAttributes( { summary: result.text } );
        } catch ( error ) {
            console.error( 'Ability request failed:', error.message );
        } finally {
            setIsLoading( false );
        }
    }

    return (
        <div { ...blockProps }>
            <Button
                onClick={ generateSummary }
                isBusy={ isLoading }
                variant="primary"
            >
                { isLoading ? 'Generating...' : 'Generate Summary' }
            </Button>
            { attributes.summary && (
                <RichText
                    tagName="p"
                    value={ attributes.summary }
                    onChange={ ( value ) => setAttributes( { summary: value } ) }
                />
            ) }
        </div>
    );
}

The block has no knowledge of which model handles summarize — it could be GPT-4o, Claude, Gemini, a fine-tuned open-source model, or a local Ollama instance. The Ability registry handles the routing.

Registering a Custom Ability in PHP

WordPress ships with a core set of built-in Abilities. To register a custom one — for example, a domain-specific classifier trained on your content:

<?php

add_action( 'init', 'register_custom_abilities' );

function register_custom_abilities() {
    if ( ! function_exists( 'wp_register_ability' ) ) {
        return; // Abilities API not available on this WordPress version
    }

    wp_register_ability( 'product-matcher', array(
        'label'          => 'Product Matcher',
        'description'    => 'Matches a customer query to relevant products from the catalog.',
        'model'          => 'openai/gpt-4o',
        'input_schema'   => array(
            'query'       => array( 'type' => 'string', 'required' => true ),
            'max_results' => array( 'type' => 'integer', 'default' => 5 ),
        ),
        'output_schema'  => array(
            'matches'    => array( 'type' => 'array' ),
            'confidence' => array( 'type' => 'number' ),
        ),
        'rate_limit'     => array(
            'requests_per_minute' => 20,
            'per'                 => 'user',
        ),
        'capability'     => 'read',
    ) );
}

The model value uses a provider/model-id notation. Swapping openai/gpt-4o for anthropic/claude-3-5-sonnet here changes every block that uses product-matcher — no block code changes required. This is the model-agnostic benefit in practice.

The Security Model

The Abilities API’s security advantages over per-plugin AI integrations:

Centralised API key management. Keys live in wp-config.php or WordPress options, server-side. No block ships its own API key in JavaScript. No key is visible in DevTools network requests.

Capability gating. The capability parameter in wp_register_ability() specifies which WordPress user capability is required to invoke an Ability. A translate Ability might require only read; a generate-post Ability might require publish_posts. AI features automatically respect your user role structure.

Rate limiting. Declared in the Ability registration. Per-user, per-site, or per-block rate limits prevent runaway API costs and abuse without custom code in every block.

Audit logging. Every Ability invocation is logged with the invoking user, the Ability name, token counts (where the model reports them), and any error. Site administrators get a centralised view of AI usage across all blocks and plugins.

For the broader WordPress security context, the same principles that govern plugin permission handling apply to AI features — covered in the integrating AI in WordPress guide.

Core Built-In Abilities

WordPress ships with a set of standard Abilities that blocks can use immediately without custom registration:

Ability name What it does Typical use
summarize Condenses long content to a specified length TL;DR blocks, excerpt generation
translate Translates content to a target language Multilingual content workflows
tone-adjust Rewrites content in a different register (formal, casual, technical) Editorial style tools
generate-alt-text Writes descriptive alt text for an image Accessibility automation
classify Assigns a category or tag from a defined taxonomy Content organisation
fact-check Verifies a claim against a provided knowledge base Editorial quality gates
suggest-links Proposes internal links from the site’s content index Internal linking automation

The suggest-links Ability is particularly relevant to the collaborative editorial workflows described in the collaborative editing guide — it’s the mechanism behind real-time AI-assisted internal linking as a writer types.

Building a Tone Switcher Block

A concrete example: a block that rewrites a paragraph in a different tone on demand.

block.json:

{
  "name": "my-plugin/tone-switcher",
  "title": "Tone Switcher",
  "abilities": {
    "required": ["tone-adjust"]
  },
  "attributes": {
    "content":         { "type": "string", "default": "" },
    "originalContent": { "type": "string", "default": "" },
    "activeTone":      { "type": "string", "default": "professional" }
  },
  "editorScript": "file:./edit.js"
}

edit.js — core Ability call:

const TONES = ['professional', 'conversational', 'witty', 'technical'];

async function applyTone( content, tone, setAttributes ) {
    const result = await wp.abilities.request( 'tone-adjust', {
        content,
        targetTone: tone,
        preserveLength: true,
    } );
    setAttributes( {
        content: result.text,
        activeTone: tone,
    } );
}

The block stores originalContent on first edit so the user can always revert. The tone switch is non-destructive — the Ability returns a new string, not a diff applied to the existing content.

Abilities API and Gutenberg Phase 3

The Abilities API isn’t confined to single-user content creation. In Gutenberg Phase 3 (the Collaboration phase), AI agents participate in editorial sessions as registered participants — and they interact with the editor through the same Abilities they’d call from a block.

An AI agent assigned to review a draft can call fact-check on specific paragraphs, suggest-links as the human writer types, and tone-adjust to flag sections that drift from the site’s style guide — all via the same Ability interface, with the same permission gating and audit logging as any other Ability invocation. The collaborative editing guide covers how AI agents slot into Phase 3 editorial workflows in full.

Performance and Core Web Vitals

The centralised architecture has a direct performance benefit. Instead of five AI plugins each loading their own SDK — adding 100–300KB of JavaScript per plugin — the Abilities API ships one shared JavaScript module. Blocks that use Abilities don’t load AI logic; they call a pre-loaded API.

AI features that trigger server-side (Abilities requested on post save or via a REST call) add no client-side JavaScript at all. Abilities triggered interactively in the editor are editor-only scripts — they don’t load on the published page. The result: AI-powered blocks can have zero impact on frontend performance.

For the full block performance picture, high-performance block themes covers the editor-vs-frontend script separation pattern. The SEO implications of AI-generated content quality are covered in the GEO optimisation guide — AI-generated content that answers specific questions well ranks better than generic content, regardless of whether it was drafted by a human or an Ability. For the full context of where AI fits in WordPress development, see AI-powered WordPress development.

When to Use the Abilities API vs. Direct Model Integration

Use the Abilities API when:

  • You’re building blocks for distribution (themes, plugins sold or shared with others)
  • You need model flexibility — the model choice should be configurable by the site admin
  • Multiple blocks on the same site will use AI — centralised auth and rate limiting matters
  • You need audit logging of AI usage per user

Direct model integration makes sense when:

  • You’re building a one-off server-side tool for a specific site that will never be distributed
  • The integration is entirely PHP-side — a scheduled process that generates content, not a block
  • You need streaming responses or model features the Abilities API doesn’t yet expose

The WooCommerce AI personalisation guide shows a concrete application of registered Abilities in a RAG-based product recommendation system — a useful reference for the direct-vs-API tradeoff on a real project.

Getting Started

The Abilities API requires WordPress 6.7+. Always check for availability before using it:

// PHP
if ( function_exists( 'wp_register_ability' ) ) {
    // Abilities API is available
}

// JavaScript
if ( wp.abilities && wp.abilities.request ) {
    // Abilities API is available in the editor
}

Blocks should degrade gracefully when a required Ability isn’t available — surface a clear message in the editor rather than a broken UI or a silent failure.

For custom Ability development scoped to a specific workflow — including custom model routing, rate limiting configuration, and audit logging setup — the WordPress plugin development service covers Abilities API registration as part of custom plugin builds. The Full Site Editing guide provides the broader block ecosystem context for where Abilities-powered blocks fit into modern WordPress theme architecture.

Frequently asked questions

The WordPress Abilities API is a standardised framework that lets Gutenberg blocks declare and invoke AI capabilities — such as text summarisation, translation, tone adjustment, and image alt text generation — through a unified interface. Blocks declare which Abilities they need in block.json and call them via wp.abilities.request() in JavaScript. WordPress handles routing to the appropriate AI model, API key management, rate limiting, and error normalisation centrally. This makes blocks model-agnostic: the specific language model used can be changed at the site-admin level without modifying block code.

A direct API call from block JavaScript requires the block to manage its own API key (which ends up in client-side code, visible in DevTools), handle its own rate limiting, implement its own error handling, and stay coupled to a specific model. wp.abilities.request() sends the invocation to a WordPress REST endpoint that handles all of this centrally — the block passes a named Ability and context, and receives a normalised response. The block has no knowledge of which model is active or how authentication works, and a single block works on any WordPress site regardless of which AI model the site administrator has configured.

No. The Abilities API is model-agnostic by design. Each registered Ability specifies a model using a provider/model-id notation (e.g. openai/gpt-4o, anthropic/claude-3-5-sonnet, ollama/llama3), but this is a site-level configuration — not hardcoded in the block. Switching models requires changing the Ability registration, not the block code. Abilities can also route to local models via Ollama or similar for sites that need on-premises AI with no external API calls.

The Abilities API requires WordPress 6.7 or later, with continued improvements rolling into subsequent releases. For features ahead of core, running the Gutenberg plugin gives approximately 4–6 weeks of lead time. Always check for API availability with function_exists('wp_register_ability') in PHP and wp.abilities && wp.abilities.request in JavaScript — blocks should degrade gracefully when the Ability they depend on isn't available rather than breaking silently.

Yes, with some caveats. The PHP registration layer (wp_register_ability) and the REST endpoint that handles Ability invocations are available to any authenticated WordPress code — not just blocks. A custom PHP process, a WP-CLI command, or a REST API consumer can invoke registered Abilities directly. The JavaScript wp.abilities.request() function is an editor-context convenience wrapper around the same REST endpoint. For server-side use cases like scheduled content generation or WooCommerce product description automation, calling the Abilities REST endpoint from PHP is the appropriate approach.

Rate limits are declared per Ability in the wp_register_ability() call — you specify requests per minute and whether the limit applies per-user, per-session, or site-wide. WordPress enforces these limits before the request reaches the AI model, returning a structured error if the limit is exceeded. For cost management, the Abilities API logs token usage per invocation (where the model reports it) and makes this available in the WordPress admin — so site administrators can see which Abilities, blocks, or users are consuming the most AI capacity. This is significantly more manageable than multiple separate plugins each making uncounted API calls.

AK

Written by Ajay Khandal

WordPress Developer — building, fixing and speeding up WordPress sites.

Work with me →