skills/wp-cli/SKILL.md
WordPress CLI operations for database management, plugins, themes, users, content, and site configuration. Use for migrations, bulk updates, user audits, content imports, or any wp-cli commands.
npx skillsauth add johnie/skills wp-cliInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this skill for WordPress command-line operations including migrations, bulk updates, database management, user audits, content imports, and site configuration.
Always verify WP-CLI and WordPress installation before proceeding:
wp --version # Check WP-CLI is installed
wp core is-installed # Verify WordPress is present
wp core version # Check WordPress version
If working in a specific directory, use --path=/path/to/wordpress or cd to the WordPress root first.
# Database backup before major changes
wp db export backup-$(date +%Y%m%d-%H%M%S).sql
# Full site backup (database + files)
tar -czf site-backup-$(date +%Y%m%d-%H%M%S).tar.gz wp-content/ backup-*.sql
wp plugin update --all --dry-run
wp search-replace 'old.com' 'new.com' --dry-run
These commands are destructive and should be used with extreme caution:
wp db reset - Deletes entire databasewp db clean - Removes tableswp site delete (multisite) - Removes site and contentwp user delete without --reassign - Orphans contentwp post delete $(wp post list --post_type=page --format=ids) - Bulk deletionsAlways confirm with the user before running these commands.
Use these flags to optimize speed and output:
--format=json # Machine-readable output (faster parsing)
--format=csv # For spreadsheet imports
--format=ids # Space-separated IDs (for piping)
--fields=ID,post_title # Limit returned fields
--skip-plugins # Bypass plugin loading (faster, but may break dependencies)
--skip-themes # Bypass theme loading
--quiet # Suppress informational output
WP-CLI commands are organized by functionality. See references/commands.md for detailed flag documentation.
wp db - export, import, query, optimize, search-replace
wp core - install, update, verify-checksums, version
wp plugin / wp theme - list, install, activate, update, delete
wp user - create, list, delete, update, generate
wp post / wp comment - create, list, update, delete, generate
wp option - get, update, delete, list
wp cache / wp transient - flush, delete, set
wp cron - event, schedule, run
wp config - create, get, set, shuffle-salts
wp site - list, create, delete, empty
# 1. Export database from source
wp db export migration.sql
# 2. Search-replace URLs (dry-run first!)
wp search-replace 'http://localhost:8000' 'https://example.com' --dry-run
wp search-replace 'http://localhost:8000' 'https://example.com' --skip-columns=guid
# 3. Transfer files (use rsync, scp, or SFTP)
rsync -avz wp-content/ user@server:/var/www/html/wp-content/
# 4. Import database on destination
wp db import migration.sql
# 5. Flush cache and permalinks
wp cache flush
wp rewrite flush
# 6. Verify
wp option get siteurl
wp option get home
# 1. Check available updates
wp plugin list --update=available
# 2. Backup database
wp db export backup-before-plugin-update.sql
# 3. Update all (or specific plugins)
wp plugin update --all --dry-run
wp plugin update --all
# 4. If issues arise, rollback
wp plugin install plugin-name --version=1.2.3 --force
# 5. Clear cache
wp cache flush
# 1. List all users with roles
wp user list --fields=ID,user_login,user_email,roles
# 2. Find inactive users (requires custom query or plugin)
wp user list --format=json | jq '.[] | select(.user_registered < "2023-01-01")'
# 3. Delete user (MUST reassign content!)
wp user delete <ID> --reassign=<new_author_id>
# 4. Generate test users (for dev environments)
wp user generate --count=10 --role=subscriber
ssh [email protected] "cd /var/www/html && wp plugin list"
Define aliases in ~/.wp-cli/config.yml:
@prod:
ssh: [email protected]/var/www/html
@staging:
ssh: [email protected]/var/www/staging
Then use:
wp @prod plugin list
wp @staging db export
wp-config.php missingcd to WordPress root or use --path=/path/to/wordpresswp-config.php credentials, verify MySQL is runningwp db createphp -d memory_limit=512M $(which wp) db exportguid column is often used in WordPress for storing URLs but should not be updated"--skip-columns=guid to suppress the warningwp-config.php changes when safe--format=json for scripting - Easier to parse programmaticallywp cli update for latest features and fixesreferences/commands.md for detailed flag documentationreferences/examples.md for complete workflow scenariostools
Designs complex generic types, refactors `any` to strict alternatives, creates type guards and utility types, resolves TypeScript compiler errors, and explains type-level concepts. Use when the user asks about TypeScript (TS) types, generics, type inference, type guards, removing `any` types, strict typing, type errors, `infer`, `extends`, conditional types, mapped types, template literal types, branded/opaque types, `satisfies`, `unknown`, function overloads, declaration merging, strict mode, or utility types like `Partial`, `Record`, `ReturnType`, `Awaited`, and `NoInfer`.
tools
Build type-safe CLI applications with Stricli. Use when creating TypeScript CLIs with typed flags/positional args, multi-command routing, or automatic help generation. Stricli catches parameter errors at compile time. Use this whenever the user mentions CLI frameworks, command-line tools, argument parsing, or typed commands in TypeScript.
tools
Create, update, and review GitHub PRs. Commands: create [-v] [--draft], update [-v], review <number|url>. Generates structured PR bodies with conditional sections (Testing, Deployment, Screenshots). Requires gh CLI.
tools
Fetch and analyze GitHub Actions logs via gh CLI. Diagnoses CI failures, detects flaky tests, profiles slow steps, and suggests fixes. Use when CI is broken, builds are failing, or you need to understand workflow run history.