Skip to content

WordPress Plugin Development with AI: Two Routes Compared

Building WordPress plugins with AI splits into two camps: chat-based prompting vs. IDE integration. One delivers fast prototypes, the other scales. Here's what works.

9 min readIntermediate

You’re a freelancer with basic PHP knowledge. You know what you want your plugin to do. The question: should you paste prompts into ChatGPT, or set up an AI-powered code editor like Cursor?

Here’s the split.

Chat-Based AI vs. IDE Integration: What Changes

ChatGPT generates code from prompts – you describe the feature, copy the output, paste it into your plugin file. Fast for prototypes. General AI tools can spin up valid WordPress plugin code without being the most efficient way to test or debug (as reported by Kinsta’s testing).

Tools like Cursor AI? Different story. They combine AI with a full IDE. Cursor’s Agent Mode reasons across your whole codebase and makes broader changes. Manual Mode gives you control to work within a specific file.

Practical difference: chat-based AI gives you code. IDE-integrated AI edits your project directly, runs terminal commands, flags errors in real time.

Your Scenario: Building a Custom Dashboard Widget Plugin

You run a small agency. Clients always ask for the same dashboard shortcuts – links to their most-used pages, a quick stats widget, maybe a branded welcome message.

You’ve hard-coded these into a plugin before. Now you want AI to build a settings panel so you can configure links without touching code again.

Let’s compare routes.

Route 1: ChatGPT (Chat-Based)

The key? The prompt – the instruction you provide. You open ChatGPT and type:

Create a WordPress plugin that adds a dashboard widget.
The widget should display custom links (configurable via a settings page).
Use the WordPress Settings API.
Include sanitization and nonces for security.

ChatGPT produces code on screen, line by line. You copy it, paste it into a new PHP file, activate the plugin. It works – settings page, textarea for links, save button.

Then you realize the links aren’t formatted as a list. You ask ChatGPT to fix it. It regenerates the entire function. Your nonce check? Gone.

This is the wall.

Route 2: Cursor AI (IDE Integration)

Getting started: download the file for your OS, install following on-screen instructions. Builds for Mac, Windows, Linux.

You open Cursor, load your plugin folder. Click the gear icon → ‘Rules for AI’ → add: ‘When working with WordPress projects, follow WordPress Coding Standards and best practices.’ Adding a rule in this section sets it as a global rule for all projects.

Press Cmd+L (Ctrl+L on Windows) to start Ask Mode. Cursor will help you reason through your idea without jumping straight to code. You describe the plugin. Cursor outlines the structure: main plugin file, settings registration, widget callback, sanitization.

You approve. It writes the files in your project. Ask it to add list formatting? It modifies only the relevant function. The nonce stays intact.

That’s the difference. Cursor understands which part of your project to touch.

The Moment AI-Generated Code Breaks Everything

At first your project comes along fine – features scratched off your MVP list fast. Then you ask for what seems like a simple change. Everything that was already working? Breaks.

Why?

AI doesn’t track working state. When you ask ChatGPT to “add a color picker to the settings page,” it regenerates the settings function from scratch. Once a plugin is stable, add prompts like: ‘Make sure your changes fit within the plugin’s existing structure’ or ‘Make this change as conservatively as possible.’

Watch out: Use version control – even if it’s just duplicating the plugin folder and dragging it away for safekeeping after completing and testing each feature.

As your code grows and your ChatGPT thread gets longer, the AI becomes prone to mistakes or forgets things. At a certain point? Start a new thread. Upload your main plugin files, explain where you left off.

Three Gotchas Nobody Mentions

1. AI Uses Deprecated WordPress Functions

WordPress has been around a while. Lot of outdated information in AI models – some of it downright crusty (as of early 2025, based on developer reports).

Your AI-generated plugin might call wp_get_user() (deprecated in 2010) instead of get_userdata(). The code runs. Seems fine. WordPress updates? Your plugin breaks on client sites.

Fix: upload more recent docs from the Codex, or even better, upload recent well-built plugins as examples. Projects in Claude are great for saving documents, as is the docs indexing feature in Cursor.

2. Security Holes AI Doesn’t Catch

Security: critical. Where AI-generated code requires the most scrutiny. AI understands general security principles. WordPress? Specific security patterns that must be followed religiously.

Query Monitor plugin automatically flags security issues in your AI-generated code: missing nonces, capability checks, unescaped output. This free tool catches issues your AI assistant might miss.

Install it. Run your plugin. Check the panel. Red warnings about “User has no capability to perform this action” or “Nonce verification failed”? Fix those before shipping.

3. AI Assumes Your Data Already Exists

AI may assume there’s data ‘somewhere’ in WordPress already and you’re just trying to pull it out. You may need to calculate data dynamically, count posts published before the plugin was activated, or count posts across multiple post types or authors.

Best tip: break the goals of your plugin into tiny parts or separate function names. Don’t expect AI to create the entire range of functions in one go.

Which AI Tool Should You Actually Use?

Tool Best For Cost Key Limitation
ChatGPT Fast prototypes, learning plugin structure Free tier available; Plus $20/month Doesn’t integrate with your project – copy/paste workflow
Cursor AI Building and iterating on real plugins Free with limits; Pro $20/month Requires local dev environment setup
GitHub Copilot Inline code suggestions while you type Free tier: 2000 completions + 50 chat requests (as of 2024); paid tiers available Works as autocomplete, not autonomous agent
Claude Code Terminal-based plugin generation with WordPress Studio Any paid Anthropic plan; WordPress Studio is free (as of February 2026) Mac-only for WordPress Studio as of early 2026

Developers using AI assistants report 40-55% faster task completion (based on Odd Jar’s October 2025 guide). But knowing which tools to use and how to use them? That’s what separates mediocre AI-generated code from production-ready WordPress plugins.

Setting Up Cursor for WordPress (5 Minutes)

You’ve decided to try the IDE route. Setup that works:

1. Install Cursor

Visit the downloads page. Download the file for your OS. Install following on-screen instructions – builds available for Mac, Windows, Linux.

2. Add WordPress Context

Click the gear icon in the top right → ‘Rules for AI’ → add this global rule: ‘When working with WordPress projects, follow WordPress Coding Standards and best practices.’

3. Open Your Plugin Folder

File > Open Folder. Navigate to your /wp-content/plugins directory.

4. Start with Ask Mode

Press Cmd+L (Ctrl+L on Windows). In this mode, Cursor will help you reason through your idea without jumping straight to code.

Type your plugin description. Be specific: what hooks you’ll use, what data you’ll store, what the settings page should look like. Cursor will outline the structure before writing a single line.

5. Let It Build, Then Review

Cursor generates files. It adds sanitization and escaping to protect against cross-site scripting. Uses i18n internationalization to make it translatable. It went ahead and added these because they’re part of WordPress coding standards.

Don’t assume it’s perfect. Be very cautious about deploying any of its code in a real-world situation without having a highly experienced dev go over it first.

What AI Can’t Do (Yet)

AI won’t:

  • Understand your client’s actual workflow – you have to describe it
  • Know which WordPress version your client runs – specify it in your prompt
  • Test the plugin on a live site – always test AI-generated code in a staging environment first; never directly use it on a live website
  • Catch theme conflicts – your plugin might work in Twenty Twenty-Four and break in Divi

Think of plugin development like building with Lego. You need to know what a brick looks like, how pieces connect, which colors exist. AI hands you a pre-built section. You still need to check if it fits your project, if the colors match, if it won’t collapse when someone touches it.

The barrier to entry for WordPress plugin development has effectively been lowered. With the right AI tools and a systematic approach, you can build functional plugins even if you’ve never written a line of PHP code. Just remember: test thoroughly, understand the limitations, always verify the generated code meets WordPress standards and security requirements.

Your Next Plugin

Pick one feature. Not a full plugin – one feature.

“Add a dashboard widget that shows the 5 most recent posts.”

Open Cursor or ChatGPT. Describe it in detail – mention hooks, mention where the widget should appear, mention you want it to respect user capabilities. Let the AI generate the code.

Then read the code. Find the hook. Find the callback function. Find the WordPress function that queries posts. You’ll learn more from reading AI-generated code than from writing it yourself, because you’ll see patterns you didn’t know existed.

That’s the real productivity gain: AI builds the scaffold, you learn the architecture.

FAQ

Can I build a WordPress plugin with zero coding experience using AI?

You need to understand code and coding problems. Think of yourself as a ‘product manager’ – clear idea of input and output, general approach, tools to be used, constraints. You don’t need to know how to code, but you need to understand what’s going on.

Which AI tool is better for WordPress plugins: ChatGPT or Cursor?

ChatGPT for learning and quick prototypes (you’re not maintaining the code long-term). Cursor for real client projects (you’ll iterate, add features, and need the AI to remember your project structure). General AI tools can spin up valid WordPress plugin code, but it may not be the most efficient way to test or debug. Tools like Cursor combine AI with a full-featured IDE for a more structured workflow.

How do I prevent AI from breaking my plugin when I ask for changes?

Three things. One: version control – even if you’re just duplicating the plugin folder after completing and testing each feature. Two: add conservative prompts: ‘Make this change as conservatively as possible and take care not to break anything that already works’ or ‘Add this feature by making as few changes to my codebase as possible.’ Three: when your thread gets long, start a new one – upload your files and explain where you left off. That last one fixes 80% of the “AI forgot my project structure” complaints.