October 10, 2026

Building Your First AI‑Powered WordPress Plugin Using Abilities API, AI Client and MCP

← AI for Your Work

WebCrimp analysis and practical explanation. AI-assisted; reviewed before publication.

Quick Summary

A step‑by‑step tutorial shows how to combine the WordPress Abilities API, the provider‑agnostic WordPress AI Client, and the MCP Adapter to create a plugin that turns an image URL into a draft post with AI‑generated description and content.

What Happened?

The guide walks through installing a starter plugin, registering three abilities (describe‑image, generate‑post‑from‑description, create‑post‑from‑photo), wiring them to the appropriate hooks, testing the abilities via REST, making AI calls with the AI Client, composing abilities, exposing them as MCP tools, and updating the admin interface.

Why It Matters

By stitching together the Abilities API, AI Client and MCP Adapter, developers can create reusable, discoverable AI functionality that works across REST, the block editor, other plugins and AI agents, reducing boilerplate and enabling future‑proof AI‑enhanced WordPress solutions.

Who Can Use It?

Web Development · Software Development · WordPress · AI/ML · Content · Marketing

How Can I Use This?

If you work in Web Development, Software Development, WordPress, AI/ML, Content, Marketing

  • Web Developers can follow the code samples to add AI‑driven features to client sites; Software Engineers can adapt the ability‑composition pattern for other SaaS integrations; WordPress Site Builders can install the finished plugin to automate image‑to‑post workflows; Content Creators can use the MCP‑exposed abilities from desktop AI assistants to generate draft posts without leaving their chat interface; Marketing Teams can leverage the generated posts for rapid campaign asset creation.

AI Tip

When testing the AI calls, start with a low‑cost, fast vision model (e.g., a small Open‑source CLIP variant) to verify image‑to‑text logic before switching to a larger, paid model for production quality.

AI Trick

Use the WordPress transient API to cache the image description for a given URL; this prevents duplicate AI requests when the same image is reused in multiple posts, saving both time and provider costs.

Example Workflow

  1. 1. Set up a local WordPress 7.0+ site with PHP 8.1+ and install Composer and Node.js. 2. Install the starter wp‑ai‑workshop‑demo plugin and run `composer install` && `npm install`. 3. Connect an AI provider via the Connectors screen and save the API key. 4. Register the three abilities in includes/abilities.php and hook them to wp_abilities_api_categories_init and wp_abilities_api_init. 5. Verify each ability over REST using an Application Password and curl. 6. Implement the callbacks using WP_AI_Client::vision() and WP_AI_Client::text() to perform describe‑image and generate‑post‑from‑description. 7. In create‑post‑from‑photo, call the two abilities via WP_Ability::execute(), then create the post and set the featured image. 8. Expose the abilities as MCP tools by ensuring the meta.show_in_rest flag is true; an MCP adapter will automatically publish them. 9. Update the admin interface to call the create‑post‑from‑photo ability via AJAX. 10. Test the full flow with an image URL and inspect the generated draft post. *Note: Each step should be verified in a staging environment before deploying to production.*

Copy This Prompt

Describe the image at {image_url} and generate a WordPress post titled {title} with content {content} using a {tone} tone.

Recommended Tools

  • WordPress development environment (local server)
  • PHP 8.1+
  • Composer
  • Node.js & npm
  • AI provider account (OpenAI, Anthropic, Google, etc.)
  • Code editor or IDE
  • Application Password or REST authentication method

Check official documentation, availability and pricing before using these suggestions.

Difficulty

Intermediate

Estimated Time Saved

Not measured; validate with your own workflow.

Source

WordPress Developer Blog – AI
Build your first AI-Powered WordPress plugin
Original publication date: 2026-07-30T17:39:44+00:00