Skip to the guide
All guides

WP-CLI and operations

Build, debug or review WP-CLI commands and WordPress operations runbooks.

app WordPress DevKit 2.0.0checked reading 4 minutes

On this page

When to use it

Build, debug or review WP-CLI commands and WordPress operations runbooks. Use for serialized-safe search-replace and domain moves, multisite targeting, batch jobs, cron and cache maintenance, backups and recoverable procedures; not application code.

Boundaries and hand-offs

Plugin hooks, upgrade logic and storage design go to wp-devkit-plugin-development; migration/upgrade risk assessment of a whole site goes to wp-devkit-migration-upgrade-review; CI/release pipelines to wp-devkit-ci-cd-and-release-engineering; cache and query performance diagnosis to wp-devkit-performance-review. This skill owns the command, its targeting and safety, and the recovery procedure around it.

Ask Claude

With the plugin loaded, start a read-only review of a bounded target:

Text
/wp-devkit:operations-review <target-path>

The short form /wp-devkit:operations requests a quick scan.

Ask Codex, ChatGPT or Antigravity

Name the installed skill and keep the request bounded. Replace the target with your files or journey.

Text
$wp-devkit-wpcli-and-ops
Review the target without editing files.
Read the project instructions and the skill's engineering contract first.
Separate confirmed findings from candidates and state the evidence and checks you could not run.

What it covers

The agent loads only the reference that matches the task:

  • command-authoring.md : read for registering commands, synopsis, dry run, exit codes, batching and memory, runcommand , testing.
  • environment-safety-and-recovery.md : read for config precedence and aliases, bootstrap risk, --skip-plugins , operation classes, backups and restore rehearsal, CI, runbook template.
  • multisite-and-batch-operations.md : read for --url / --network , site iteration, switch_to_blog , long jobs, WP-Cron vs system cron, cache and transient maintenance, locks.
  • search-replace-and-migrations.md : read for domain moves, serialized and JSON data, GUIDs, --export , backups, destructive DB commands.
  • wpcli-and-ops-workbook.md : Scoped commands and operational recovery workbook

How a review runs

  1. Read the command source, wp-cli.yml , aliases and scripts without loading WordPress: a command that loads WordPress runs the project's bootstrap, so "read-only" is not a property of the verb.
  2. Confirm target identity: --path , --url , alias, DB prefix, network vs site scope, environment. Check the installed wp help <command> before assuming flags such as --dry-run exist; --dry-run is per command.
  3. Classify each operation: inventory, diagnostic with effects ( cron event run , cache flush , eval ), reversible, irreversible. For irreversible ones require a verified backup, a dry run, scope and approval.
  4. For code: argument validation before writes, stable keyed batching with a fixed upper bound, per-query and per-write error handling, truthful counts and non-zero exit on partial failure, site context restored on every path, dry run with zero side effects.
  5. For runbooks: preconditions, exact commands, expected output, independent verification, rollback with a rehearsed restore, abort criteria, redacted logs.
  6. Describe the plan and verification without running maintenance or mutating commands. Classify per the contract; use insufficient evidence when target, version or backup state cannot be established. Read references/wpcli-and-ops-workbook.md for symptom triage, worked decisions, benign look-alikes and verification. Load topic references only when in scope: - references/command-authoring.md : read for registering commands, synopsis, dry run, exit codes, batching and memory, runcommand , testing. - references/search-replace-and-migrations.md : read for domain moves, serialized and JSON data, GUIDs, --export , backups, destructive DB commands. - references/multisite-and-batch-operations.md : read for --url / --network , site iteration, switch_to_blog , long jobs, WP-Cron vs system cron, cache and transient maintenance, locks. - references/environment-safety-and-recovery.md : read for config precedence and aliases, bootstrap risk, --skip-plugins , operation classes, backups and restore rehearsal, CI, runbook template.

What you get back

Review: result and reviewed scope first. Each confirmed finding: file:line, actor, trigger, reachable path, impact, confidence, severity (per contract), minimal fix, regression. Candidates and missing evidence separate. Implementation or runbook: target, plan, commands with expected output, verification, rollback, executed vs unexecuted checks and exit statuses.

Note

Reviews are read-only. A clean review covers the inspected scope; it is not a certification. Ask for implementation as a separate, bounded task with a regression check.

Where to go next

Use review to fix for a bounded implementation and Doctor and reports for environment and evidence tooling.