Run WordPress operations with WP-CLI - safe search-replace and domain migration, db export/import, plugin/theme/user management, cron, cache flushing, multisite, and repeatable automation via wp-cli.yml.
---
name: wp-wpcli-and-ops
description: Use when working with WP-CLI (wp) for WordPress operations - safe search-replace, db export/import, plugin/theme/user/content management, cron, cache flushing, multisite, and scripting/automation with wp-cli.yml. Requires WP-CLI in the execution environment.
---
Run WordPress ops via WP-CLI with explicit blast-radius guardrails - these commands can be destructive.
## Workflow
1. Guardrails first: confirm the environment (dev/staging/prod) and targeting (`--path`, multisite `--url`), and back up before any write.
2. Inspect WP-CLI and targeting deterministically with `wpcli_inspect.mjs --path=<path> [--url=<url>]`.
3. For URL/domain migration: `wp db export`, then `wp search-replace --dry-run` to review, then the real replace, then flush caches/rewrite.
4. Manage packages with `wp plugin *` / `wp theme *`; inspect and run individual cron events rather than blindly running everything.
5. For multisite, decide single-site (`--url=`) vs network-wide (`--network`) before each command.
6. Make ops repeatable with `wp-cli.yml` defaults and scripts that log commands and stop on error; re-run the inspector after changes.
Full skill & source: https://github.com/WordPress/agent-skills/tree/aa735ea7111c7924ee988306bcef70439e17dec9/skills/wp-wpcli-and-ops