Site icon Grace Themes

How to Build Your First WordPress Plugin with Claude Code

WordPress Plugins
According to the U.S. Bureau of Labor Statistics, the typical path into software development requires a bachelor’s degree and several years of experience before someone is considered a working developer. AI coding tools are not replacing that path, but they are giving non-developers a real way to solve their own small problems without waiting on someone else.

For most of WordPress’s history, building your own plugin meant either learning PHP from scratch or paying a developer $300 to add a feature that took them twenty minutes. There was no middle ground. If you wanted a small custom function on your site, you were either capable of writing it yourself or you were not.

What You Need Before You can Start using Claude code

You will need three things on your machine:

With Claude Code, Anthropic’s terminal-based coding assistant, you can describe what you want in plain English and watch a working plugin appear in your project folder. It is one of a growing number of AI tools that have quietly made things possible for non-developers that used to require a degree.

The Next step, Open the Terminal in the Right Place

This is the part beginners get wrong most often. Claude Code needs to run inside your WordPress project folder, not in your home directory. In WordPress Studio, go to the Overview tab of your site and click “Open in” then “Terminal.” This opens a terminal window already pointing at the right folder.

Once the terminal is open, type:

claude

The first time you do this, you will be asked to log in to your Anthropic account. After that, you are inside Claude Code and ready to start describing what you want to build.

Describe Your Plugin in Plain English

This is the moment most people freeze. They think they need to write a technical specification. They do not. Claude Code works best when you describe what you want like you are explaining it to a friend who happens to know WordPress.

A good first prompt looks something like this:

“We are in the root of a WordPress site. I want a simple plugin called Quick Notice that shows a yellow banner at the top of the admin dashboard with a customisable message. The message should be editable from a settings page under the Settings menu.”

Notice what is in the prompt:

The clearer you are about these four things, the less back-and-forth you need. Claude will usually ask one or two follow-up questions before generating any code, then create a proper plugin folder with the main PHP file, the settings page, and all the WordPress hooks wired up correctly.

Activate and Test

Once Claude has generated the files, go back to WordPress Studio and open the WordPress admin. Click Plugins. Your new plugin should be sitting in the list, ready to activate.

Activate it. If you wrote a clear prompt, the plugin will work on the first try. If something does not look right, do not panic. Go back to the terminal and tell Claude what is wrong. Be specific. “The yellow banner is showing but the settings page is blank” is a useful sentence. “It does not work” is not. Claude will read the files it created, find the problem, and patch it.

It is worth remembering that WordPress itself exists because of an older idea about how software should work. The platform is built on the GNU General Public License, the same license that has shaped the open source software movement since 1989. The philosophy behind that license is simple: software should be free to use, modify, and share.

This is the loop. Describe, generate, test, describe again. Most small plugins take three to five rounds of this loop before they are finished.

Use Git from Day One

Before you do anything serious with Claude Code, initialise a Git repository in your plugin folder. Run:

git init

Then commit after every working version. The reason is simple: AI tools sometimes make changes that break things, and you want to be able to roll back to the last working version without losing your work. This single habit will save you hours of frustration over the course of a project.

6 simple Plugin Ideas to help you practice

If you are looking for something to build that is more useful than a “Hello World” plugin, here are a few that solve real problems most WordPress site owners have:

  1. A plugin that disables comments on all posts older than 90 days
  2. A plugin that adds estimated reading time to the top of every blog post
  3. A plugin that emails you a weekly summary of new user registrations
  4. A plugin that hides the WordPress version number from page source for security
  5. A plugin that adds custom fields to WooCommerce checkout
  6. A plugin that auto-generates social media meta tags for every post

Each of these is something you can describe to Claude in two or three sentences and have working in under an hour. The boring middle layer of WordPress development, the part that used to require knowing exactly where to register a hook and which function to use, is now genuinely accessible to people who do not write code for a living.

What to Watch Out For

A few honest cautions before you start shipping plugins to client sites:

Read the code before you trust it. Claude is good but not perfect. For anything you plan to use on a live site, scroll through the generated files and ask Claude to explain any section you do not understand. You do not need to write code, but you should be able to read it well enough to spot something obviously wrong.

Test on a staging copy, not production. Even after the plugin works locally, do not push it straight to a live site. Set up a staging environment, test there, and only then deploy.

Respect the WordPress plugin guidelines. If you ever want to publish your plugin to the official WordPress plugin directory, there are strict rules around security, escaping output, and not phoning home. Ask Claude to review the code against the WordPress coding standards before you submit.

Be careful with database changes. Plugins that create or modify database tables can leave a mess if uninstalled wrong. Always ask Claude to include proper activation and uninstall hooks.

Exit mobile version