Building a WordPress Block Theme: Templates, Styles, and Accessibility
A WordPress block theme lets developers and site owners use blocks to edit every part of a site, including shared areas such…
When you manage a WordPress site from a coding workspace, Claude Code can run tools that inspect and change the site. The WordPress REST API lets tools read and change site data by sending HTTP requests. WP-CLI runs WordPress commands in a shell, a text-based command line. Playwright controls a browser to check what visitors see. Claude Code can use these interfaces through commands and, when configured, connections to external tools.
First inspect the target. Then make a small change through the interface that fits the task, and check both the saved WordPress record and the page visitors see. Use REST for specific content updates over a network, WP-CLI for command-line administration and repeatable commands, and Playwright to check the page in a browser. Claude Code can coordinate those steps, but a person must control its permissions and the credentials it uses.
The WordPress REST API is a good fit when the site is reachable over HTTPS and the needed content fields are exposed. Its posts endpoint lets you read and update posts, including their title, content, status, categories, tags, and featured media. For example, an update to a post uses POST /wp/v2/posts/<id>. Set the status to draft to save a change for review before publishing it.
Use WP-CLI when you have command-line access to the WordPress installation and want to inspect or maintain the site. Its post commands include listing, retrieving, creating, and updating posts. A basic inspection and draft update might look like this:
wp post get --fields=ID,post_title,post_status
wp post update --post_status=draft --post_title="Reviewed headline"
Replace <post-id> with the ID of the intended post. For a remote installation, WP-CLI supports running commands over SSH. The remote host must have WP-CLI, and SSH must work without interactive prompts.
Playwright opens a browser, performs actions, and checks the page. Use it after a content change to confirm that the expected headline appears, a link works, or a page still loads. Playwright’s test assertions can check page text and titles, as well as URLs. A browser check adds to a REST or WP-CLI check: the page can look right even when the saved status or another field is wrong.
| Task | Use |
|---|---|
| Read or update exposed content on a reachable site | REST API |
| Inspect posts or run shell-based maintenance | WP-CLI |
| Check a page or user interaction in a browser | Playwright |
| Coordinate commands and connected tools | Claude Code |
First identify the correct site, environment, post type, and record. A staging site and a production site can contain similar content, so confirm the target before issuing a write command. With WP-CLI, retrieve the post’s title and status before updating it. With REST, read the record and check its ID and current status before sending an update.
For a REST update, send only the fields you want to change to that post’s endpoint. With WP-CLI, include only those fields. Then read the post again. Verify the returned or re-read record to confirm that WordPress saved the expected title, content, and status.
The REST API does not automatically expose every custom content type or field. A site owner must register custom post types for REST access, and custom metadata, or extra fields attached to content, must also be registered and exposed. WordPress describes the show_in_rest setting for custom content types. If a field is missing, check the site’s registration and the account’s permissions rather than assuming another prompt or endpoint will make that field writable.
Authentication identifies the account making a request. Authorization determines what that account may do. Before allowing REST actions, WordPress checks the authenticated user’s capabilities, or permissions. For remote API access, Application Passwords give you separate credentials for API access that you can revoke one at a time. WordPress introduced them in version 5.6 and recommends using them over HTTPS. Use a dedicated account with only the capabilities needed for the task, and keep its password out of source files and command history.
WP-CLI runs with the access available to the shell user and the WordPress installation. WP-CLI can also behave differently from a REST request: the wp post update documentation notes that WP-CLI skips WordPress permission checks for some taxonomy inputs, such as categories and tags. Check taxonomy changes, such as category and tag changes, carefully, especially when one command updates multiple posts.
Claude Code can run shell commands and can connect to external tools through MCP, a shared set of rules that lets AI applications connect to tools and data. Configure Claude Code permissions to keep routine inspection separate from actions such as publishing, deleting content, changing plugins, or running bulk updates. Require human approval for those changes. disabling permission prompts removes that safeguard.
Playwright can save browser state, including cookies and headers that let a test user access pages. Keep that state out of version control, as the Playwright authentication guidance advises. Use a test account and browser session suited to the pages you need to verify.
After changing a post, read its WordPress record again, using the same interface or another way to retrieve it. Confirm that the intended fields changed and that the post remains in the expected status. Then use Playwright to open the relevant page and check the visible result. Playwright creates separate browser contexts for tests, so each test keeps its cookies and stored data separate; see its guidance on browser contexts.
These checks answer different questions. A REST response or WP-CLI result confirms stored data; a browser test confirms what a visitor can see and do. A browser check alone does not prove that the post is private, that no unintended records changed, or that every metadata field is correct. For bulk changes, inspect the affected records before and after the command. If a change carries substantial risk, use a staging site or a recovery plan suited to that environment.
Give Vroni a GitHub issue, bug report, spec, or rough idea. It reads the repo, plans the change, writes code, runs checks, and works toward a review-ready pull request.
Take a look at vroni.com