How I Build WordPress Plugins With AI
For years I'd wanted to build my own plugins. When I finally started, with OpenCode and my harness, I meant to start a plugin business: a free plugin with the potential for a pro upgrade. It hasn't really worked out like that. What came out of it is four free plugins on WordPress.org, maintained by me, and a way of building them that I trust.
What I actually ship
Four plugins are live on WordPress.org, all free and GPL-2.0 or later:
They're all on my WordPress.org profile, and the source for each is on GitHub: msc-post-expiry, msc-scheduled-visibility, msc-stealth-login and msc-last-updated.
Each one does a single job that made sense to me, like expiring a post or showing when it was last updated. The research I did first kept changing every time I ran it, so in the end I built the things I understood.
Three pro plugins are in development: MSC Translation Health, MSC WC Store Health Monitor and MSC Multilingual SEO Auditor. None of them is released, and I won't call them shipped until they are. I keep one file that says what's live and what isn't, and that file wins when my memory gets optimistic.
Tools first, then the agents
Before the agents write anything, there's the scaffold. An AI will always give you a slightly different result. An AI that uses a tool gives you the same, or very, very similar, result every time.
So every plugin starts from the WP Plugin Scaffold: a PHP script, a set of templates and one JSON config. It builds the plugin's structure, the free version and, when the config has a pro block, the pro version. Same class naming, same text domains, CSS and JS in the same place, WordPress's own admin screens. How it works, step by step, is in Scaffolding a WordPress Plugin in an Afternoon.
The scaffold isn't the plugin. It's the frame. The agents fill it, and I still decide what goes in.
What the agents do, and what I read
The agents write most of the code now: the glue, the first pass of each function, the escaping, the PHPUnit scaffold, the diffs. A junior agent writes, a code reviewer checks, and after two rounds a critical error goes up to a senior agent. That setup came out of one expensive night, which I wrote up in One Expensive Night, and the Junior/Senior Split It Forced.
Then I read every patch before it lands. Does it follow WordPress's conventions? Does the security hold? Will it do what a site owner expects when something goes wrong? The agent can propose. Whether it's right for WordPress is my call.
I used to be the one doing those hours. I listen to about six hours of music a day, and with progressive house on and my headphones on I could sit at my desk for 4 or 5 hours straight just coding. Everything just flowed out of me. Now the harness does those hours.
I also keep the agents on a short lead. They can commit, but they can't make branches or pull requests, and each task is small enough to commit on its own. When an agent once "fixed" a checkbox by changing PHP files and adding a second REST endpoint for the same job, the small commits made it easy to bring it back in line.
Green checks, sent back anyway
Every plugin I've submitted to WordPress.org went through the agent review and the automated plugin checks first, and passed almost every part of them. Then a person at WordPress.org looked at it and sent it straight back.
The agent hadn't fixed the queries that didn't use $wpdb->prepare(). It had added a comment telling the linter to ignore that rule. It had also missed some escaping. After a lot of back and forth I rewrote the skill my agents use to review a plugin, so a comment that switches off a lint rule is now a finding, not a pass.
That's why I treat the WordPress.org guidelines as instructions the agents build against from the start, not a hurdle at the end. And it's why the review is mine.
Where AI doesn't help yet
AI is weak where WordPress work depends on why: why a site runs a particular setup, why an old pattern is still there, what a real person will do with a setting they don't fully understand. It's good at the known shape and poor at the unknown reason.
It doesn't replace a security review either. I review more code than I used to, and most of it I didn't write. The judgement didn't go away. It moved to the review.
What I'd tell someone starting now
- Build your tools first. A scaffold and a review skill give you the same result every time. A prompt doesn't.
- Check your research twice. Mine changed every time I ran it, and some of its ideas made no sense.
- Only build what you understand. I went heavy into a pro plugin and found I had no passion for it. Without that, there's no point continuing.
More in this category
- Scaffolding a WordPress Plugin in an Afternoon: the scaffold, step by step.
- How AI Changed the Way I Do WordPress Development: the same tools on client work.
- Coding Is Not the Same as Developing and Why My Orchestrator Isn't Allowed to Write Code: the groundwork.
The rest of this category (free and pro structure, reviewing AI-written plugin code, the WordPress.org guidelines as agent instructions, running a plugin catalogue with agents) will link in here as each one is published.
If you want help setting this up for your team, contact Donovan.