Developers

Claude Code and WordPress: a developer’s setup

Connect Claude Code to WordPress with a key, pick the Developer level, work on staging or a local copy, set checkpoints, and know what rescue mode and rollback cover.

31 October 2026 · 6 min read · By the PowerWP team

Blog / Developers

Claude Code connects to WordPress through MCP, with a connection key you set up once. Give that connection the Developer permission level and Claude Code can read logs, edit files and query the database through your site’s tools. For a safe Claude Code WordPress setup, work on staging or a local copy and set a checkpoint before every job.

Connect Claude Code to WordPress in one message

Claude Code is Anthropic’s agent app. It runs in the Code tab of the Claude app and in a terminal, and you describe jobs in plain words. PowerWP AI recommends it for developers and power users. It connects with a key, not a sign-in, so it needs no public address.

  1. In WordPress, open PowerWP AI › Connections and choose Create connection. Pick Claude Code and name the connection. Add the computer’s name if you use Claude Code on more than one.
  2. Choose what it may do (see the next section) and select Create key and show steps.
  3. Copy the message under Let Claude Code connect itself and paste it into a Claude Code chat. It adds your site to your user account.
  4. Start a new session and type /mcp. Your site is listed as connected.

The message holds your key, so paste it only into your own account. If you prefer a command, the setup window also shows a ready claude mcp add line.

The key is shown once, and PowerWP AI stores only a hash of it. If you save it in a .mcp.json file, keep that folder private and out of Git. To keep the key out of the file, write ${POWERWP_TOKEN_YOUR_STORE} in its place and set that environment variable.

Choose the Developer permission level

The Developer preset gives Read & diagnostics, Content & store data, Settings & maintenance, Files, Database writes, Plugins & themes and Backups & restore. It leaves out Secrets and Users.

That split is deliberate. Secrets reveals wp-config credentials and API keys. Users covers accounts and roles. Add either for one task only, then take it away.

Under More options, set an expiry. The choices run from 7 days to never, and 90 days is preselected. You can also add an IP allow-list. For client work, create one connection per person and per site, and revoke it when the job ends.

Changes need a paid plan. Free is read-only. Solo costs $9 a month per site and includes one AI connection.

Work on staging or a local copy

Large changes belong on a copy. PowerWP AI doesn’t create staging copies and doesn’t push changes to the live site. Use your host’s staging tool, a local copy, or a backup restored on another site. The staging guide walks through it.

  • A local site needs a license key too. That covers localhost, 127.0.0.1 and addresses ending in .test, .local and a few similar names. A paid plan covers one local copy without using up its site. A second local copy counts as a site. With no key or a Free key, a local site is read-only.
  • A public staging subdomain needs its own license. Each public site does.
  • Set Environment to Staging under Settings › General. On Production, AI apps are told to be conservative. On Staging they are only told the name.

A copy made from the database can carry the original’s connections and license key. On the copy, revoke what must not reach it and create a new connection for Claude Code. A copy of a store can also send real e-mails until you switch that off.

Set a checkpoint before every job

Make this a habit in every Claude Code WordPress job. A checkpoint is a marker in the change log. It copies nothing, and it lets you roll back everything that connection changes afterwards, in one step. Ask for it in plain words:

Before you start, create a checkpoint called “before theme update”. Then show me a plan and wait for my OK.

A checkpoint covers only the connection that set it. Your own edits in wp-admin are not part of it. PowerWP AI also groups changes into work sessions, which start after 30 minutes without a change. Checkpoints and work sessions explains both.

For plugin updates, big search and replace or anything near a restore, make a backup first. Claude Code can run backup_create, download the files to your computer and confirm their checksums by itself. The server copy is then removed.

File and database tools

Claude Code reads and edits files with the fs_* tools. It queries and changes the database with db_query, db_execute and db_search_replace. The tools reference lists all 85.

  • Files. Prefer small edits with fs_edit over rewriting a file. PHP is syntax-checked before it is written. A file above the snapshot size limit (256 MB by default) isn’t changed at all.
  • Health check. After PHP changes in plugins and themes, or a plugin or theme update, PowerWP AI loads your home page and wp-admin again. If the site now shows a fatal error, it reverts the change.
  • Database. db_query runs SELECT queries with the read permission. Write queries get automatic row or table snapshots. A single-table UPDATE or DELETE that would change more than 5,000 rows is refused, and one without a WHERE condition needs explicit confirmation.
  • Search and replace. db_search_replace handles serialized data and skips the guid column. Ask for a dry run first.

When a plugin crashes the site: rescue mode

When a fatal error stops WordPress from starting, a normal request gets nothing back. Rescue mode fixes that for Claude Code. If WordPress hits a fatal error while it starts for a request with a valid key, PowerWP AI turns rescue mode on for 30 minutes.

That request fails with an explanation, and the retry runs with only PowerWP AI loaded. Your other plugins and theme are switched off for that request. A typical repair looks like this:

  1. Claude Code reads the error log with error_log_read and finds the file that crashed.
  2. It checks changes_list to see whether a recent change caused it.
  3. With your yes, it rolls the change back, or deactivates the plugin with plugin_manage.
  4. It tests the site in normal mode, then switches rescue mode off.

Must-use plugins stay on. If PowerWP AI itself can’t load, Claude Code can’t reach the site. Then use the recovery link WordPress e-mails to the admin address, or your hosting panel. Rescue mode has the details.

What is recorded, and what can’t be rolled back

PowerWP AI records changes to files, folders, options, database rows and tables, plugin state, the active theme and search and replace. By default you can roll them back for 30 days. The activity log keeps every request, so you can see what Claude Code did.

Some things can’t be rolled back. The log marks cache flushes, backups and restores, runs of cron jobs and WooCommerce tools, and runs of other plugins’ abilities as Irreversible. A rollback can’t call back an e-mail that already left your site, or undo the database changes a plugin update already made. What can’t be undone has the complete list.

Questions

Can Claude Code work on a site on my own computer?

Yes. Claude Code runs on your computer and connects with a key, so the site needs no public address. Rescue mode also starts for connections with a key. The local site needs a license key, and a paid plan covers one local copy.

What if my connection key leaks?

Revoke the connection under PowerWP AI › Connections. That ends its access at once. A revoked connection can’t be restored, so create a new one. The AI access switch in the header pauses every app while you sort it out.

Can I use one plan for several client sites?

No. A plan covers one site, so each client site needs its own. For many sites, write to us.

Try it on your own site. The Free plan is read-only: Claude Code can look at everything on a site and change nothing, with no card and no end date. When you want it to fix things, upgrade with the same key.

More from the blog.

31 Oct 2026 · 6 min read WordPress white screen of death: find the cause and fix it (with or without AI) A blank page or a critical error is almost always a plugin or theme. How to find it and switch it off by hand, and how an AI… Read → 31 Oct 2026 · 6 min read Will AI replace WordPress developers? What it can and can’t do in 2026 AI apps now handle much of the everyday upkeep on a WordPress site. Developers still own architecture, integrations and accountability. An honest look at where the line sits. Read → 31 Oct 2026 · 5 min read Is there a Claude WordPress plugin? What works in 2026 Claude reaches a WordPress site through MCP. Here are the options for self-hosted sites, from the official adapter to free plugins, and a short checklist to choose. Read →