A step-by-step guide to building an AI-powered WordPress plugin called 'Photo to Post' using three WordPress Core AI building blocks: the Abilities API, the WordPress AI Client, and the MCP Adapter. The plugin takes an image URL, uses a vision AI model to describe it, generates a blog post from that description, and creates a draft post with the image as the featured image. The tutorial covers registering composable Abilities in PHP, making provider-agnostic AI calls via the WordPress AI Client, composing abilities together, wiring up a JavaScript admin UI using the Abilities JS API, and exposing the functionality to AI agents via MCP — all without writing separate code for each interface.

24m read timeFrom developer.wordpress.org
Post cover image
Table of contents
What we’re buildingBefore you startConnecting your site to your AI providerBuilding the plugin functionalityStep 1: Register the abilitiesStep 2: Hook the abilities inStep 3: Check your work over RESTStep 4: Describe the image (your first AI call)Step 5: Generate the post copyStep 6: Compose the abilities (the good bit)Step 7: Update the Admin InterfaceStep 8: Hand it to an AI agent (MCP)Wrap up
5.7K Impressions