wp-wpcli-and-ops

Use this skill for WordPress operational work:

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "wp-wpcli-and-ops" with this command: npx skills add vapvarun/claude-backup/vapvarun-claude-backup-wp-wpcli-and-ops

WP-CLI and Ops

When to use

Use this skill for WordPress operational work:

  • wp search-replace (URL changes, domain migrations)

  • DB export/import, resets, inspections (wp db * )

  • Plugin/theme install/activate/update

  • Cron event listing/running

  • Cache/rewrite flushing

  • Multisite operations (wp site * , --url , --network )

  • Building repeatable scripts (wp-cli.yml , shell scripts)

Inputs required

  • Environment (dev/staging/prod) and safety constraints

  • Site root path: --path=<wordpress-root>

  • Multisite: --url=<site-url> if applicable

  • Any restrictions (no writes, no plugin installs, maintenance window)

Procedure

  1. Safety guardrails

WP-CLI commands can be destructive. Before any write operation:

  • Confirm environment (dev/staging/prod)

  • Confirm targeting (path/url)

  • Make a backup for risky operations

  1. Safe URL/domain migration

Step-by-step:

1. Backup database first

wp db export backup-$(date +%Y%m%d).sql --path=/path/to/wp

2. Dry run to review impact

wp search-replace 'old-domain.com' 'new-domain.com' --dry-run --path=/path/to/wp

3. Execute the replacement

wp search-replace 'old-domain.com' 'new-domain.com' --path=/path/to/wp

4. Flush caches and rewrites

wp cache flush --path=/path/to/wp wp rewrite flush --path=/path/to/wp

Common flags:

Flag Purpose

--dry-run

Preview changes without applying

--precise

Exact match only

--recurse-objects

Handle serialized data in objects

--all-tables

Include non-WP tables

--skip-columns=guid

Skip GUID column (recommended)

  1. Database operations

Export

wp db export backup.sql

Import

wp db import backup.sql

Query

wp db query "SELECT ID, post_title FROM wp_posts LIMIT 5"

Optimize

wp db optimize

Reset (DESTRUCTIVE)

wp db reset --yes

  1. Plugin/theme management

List plugins

wp plugin list

Install and activate

wp plugin install query-monitor --activate

Deactivate

wp plugin deactivate plugin-name

Update all

wp plugin update --all

Same for themes

wp theme list wp theme install theme-name --activate

  1. Cron management

List scheduled events

wp cron event list

Run a specific event

wp cron event run my_event_hook

Test cron is working

wp cron test

  1. Cache operations

Flush object cache

wp cache flush

Flush transients

wp transient delete --all

Flush rewrite rules

wp rewrite flush

  1. Multisite operations

List all sites

wp site list

Run command on specific site

wp option get blogname --url=https://subsite.example.com

Run command on all sites

wp site list --field=url | xargs -I {} wp option get blogname --url={}

Network-wide plugin activation

wp plugin activate plugin-name --network

  1. Automation with wp-cli.yml

Create wp-cli.yml in site root:

path: /path/to/wordpress url: https://example.com user: admin

Environment-specific

@staging: url: https://staging.example.com

@production: url: https://example.com ssh: user@server/path/to/wordpress

Usage:

wp @staging plugin list wp @production cache flush

Verification

  • Confirm intended side effects occurred

  • Check URLs are correct after search-replace

  • Verify plugins/themes in expected state

  • Run health check if available: wp doctor check

Failure modes / debugging

"Error: This does not seem to be a WordPress installation"

  • Wrong --path

  • Missing wp-config.php

Multisite commands affecting wrong site

  • Missing or wrong --url

Search-replace causing serialization issues

  • Use --precise flag

  • Don't replace with different length strings in serialized data without --recurse-objects

Escalation

  • If you cannot confirm environment safety, do not run write operations

  • For production changes, always backup first

  • Document all commands run for audit trail

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

wp-theme-development

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

code-review

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

typescript

No summary provided by upstream source.

Repository SourceNeeds Review