I Built a WordPress Plugin with Claude Code – Here’s What Actually Happened

Finding a post ID in WordPress is one of those things that sounds simple until you’re doing it for the tenth time that week.

You hover over the post, look at the URL in the status bar, squint at the number buried in ?post= and try to remember it long enough to paste it somewhere. Or you click into the editor just to grab the ID from the URL. It works. It’s also mildly annoying every single time.

So I built a plugin that adds a Copy ID button directly to the Posts and Pages list. One click, ID’s in your clipboard, done.

The interesting part? I built it with Claude Code. Start to finish.


Why Claude Code?

I’ve been experimenting with AI coding tools for a while, and most of my experience has been the usual — paste some code, ask for help with a specific function, get a suggestion that’s 80% right and needs tweaking.

Claude Code is different. It actually works inside your project. It can read your files, write code, run commands, and follow context across the whole session. For something like a small WordPress plugin, it felt like the right test.

Would I end up babysitting it the whole time? Or could I actually hand it a task and trust the output?

Starting With the Plugin Structure

I started simple. I told Claude Code to create the basic plugin structure — just the folder and the main PHP file with the proper header. No functionality yet. I wanted to see if it knew WordPress conventions before throwing the real work at it.

It did. The header came out correctly formatted, with Plugin Name, Version, Author, Text Domain, the works. It even added an ABSPATH check at the top — the standard security line that blocks direct file access. Small thing, but it tells you the tool understands what it’s building, not just what you typed.

if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

One file. Clean. No fluff.


Adding the Functionality

The actual feature is straightforward from a WordPress standpoint. There are two filters — post_row_actions and page_row_actions — that let you inject links into the row actions on the admin list screen. You’ve seen those: Edit, Quick Edit, Trash, View. That’s where I wanted “Copy ID” to show up.

I described what I wanted, and Claude Code handled it cleanly. It used both filters, wrapped the post ID with absint() for sanitization, used esc_attr() and esc_html() in the right places, and only loaded the JavaScript on edit.php — not across every admin page. That last part matters if you care about keeping things lightweight.

The JavaScript side was a small IIFE. It uses navigator.clipboard.writeText() to copy the ID, with a fallback for older browsers that don’t support the Clipboard API. After the copy, a small “ID copied!” message appears next to the link for two seconds, then disappears. No alerts, no page refresh.

I didn’t ask for the fallback. It added it anyway.


Reviewing the Code

This is the part I always do before calling anything done — actually read what was generated.

Overall, it held up. The security basics were there. It wasn’t loading anything globally that it didn’t need to. The JavaScript was wrapped in an IIFE with 'use strict', which is the right call for something that runs on an admin page shared with other plugins.

One thing I noticed: it used a delegated event listener on document rather than binding directly to each link. That’s the right approach here because WordPress admin tables can be updated by bulk actions, which re-render rows without a full page reload. Direct bindings would break. Delegated listeners don’t.

That’s not something I explicitly asked for. It just made the right call.


Testing It in WordPress

Activated the plugin, went to Posts. Hovered over a row. “Copy ID” appeared right there next to the other row actions. Clicked it, pasted into a notes app — correct ID, instantly.

Went to Pages. Same thing. Worked on the first try.

I’ll be honest — I half expected to spend twenty minutes debugging something. That didn’t happen here. Whether that’s the plugin being genuinely simple, or Claude Code being genuinely good at WordPress, probably a bit of both.


What I’d Actually Use This For

If you manage content at any scale — a membership site, a WooCommerce store, a site with custom post types — you’re looking up IDs constantly. For WPML, ACF relationships, custom queries, shortcodes that take an ID parameter, debugging template logic. The list goes on.

This plugin doesn’t solve a complicated problem. It solves an annoying one. Those are sometimes more worth solving.


My Honest Take on Building WordPress Plugins with Claude Code

It’s genuinely useful, especially for something scoped and practical like this. It knows WordPress hooks and functions. It follows security conventions. It doesn’t just give you code that works — it usually gives you code that works correctly, which are two different things.

That said, you still have to read what it produces. I wouldn’t ship anything without reviewing it first. But reviewing code is a lot faster than writing it from scratch, and when the starting point is already solid, the review goes quickly.

For WordPress developers who want to build small utilities without setting up a boilerplate project from scratch, it’s genuinely a good workflow.


Try It Yourself

The plugin is small enough that you could build something similar in an afternoon. If you want to follow along or use it as a starting point, I walked through the entire process in the video linked below.

The full plugin code is available on GitHub if you want to use it or build on it: https://github.com/makitweb/makitweb-copy-id

If you build something with Claude Code for WordPress — whether it’s something useful or something you’re just experimenting with — I’d be curious to hear how it went.

Leave a Comment