Wp Wpcli And Ops
Use when working with WP-CLI (wp) for WordPress operations: safe search-replace, db export/import, plugin/theme/user/content management, cron,
What Is This?
Overview
WP-CLI is the official command-line interface for WordPress, providing a powerful set of tools to manage WordPress installations without using the web-based admin panel. It allows developers, system administrators, and DevOps engineers to perform complex WordPress operations through terminal commands, making automation, scripting, and bulk operations significantly more efficient than manual browser-based workflows.
The skill covers the full range of WP-CLI capabilities, including safe search-replace operations across the database, database export and import, plugin and theme management, user administration, content operations, cron job management, cache flushing, and multisite network administration. It also includes configuration and automation through wp-cli.yml files, enabling repeatable and scriptable WordPress workflows.
This skill targets WordPress 6.9 and above, running on PHP 7.2.24 or higher, and requires WP-CLI to be available in the execution environment. It is designed for operational work where precision, repeatability, and safety are critical requirements.
Who Should Use This
- WordPress developers who need to automate repetitive site management tasks across multiple environments
- DevOps engineers managing WordPress deployments in CI/CD pipelines or containerized infrastructure
- System administrators responsible for maintaining WordPress installations on servers without GUI access
- Agency teams handling migrations, staging deployments, and production database operations for client sites
- Site reliability engineers who need scripted, auditable WordPress operations for compliance or rollback purposes
- Technical content managers performing bulk content updates, user imports, or taxonomy restructuring at scale
Why Use It?
Problems It Solves
- Manual database search-replace operations during migrations are error-prone and can corrupt serialized PHP data. WP-CLI handles serialized data correctly during replacements.
- Exporting and importing databases through phpMyAdmin or hosting control panels is slow, size-limited, and difficult to automate. WP-CLI provides direct, scriptable database operations.
- Managing plugins, themes, and users across dozens of sites manually is time-consuming. WP-CLI enables bulk operations with a single command or script.
- Debugging cron issues and cache inconsistencies through the WordPress admin is opaque. WP-CLI exposes these systems directly for inspection and control.
- Repeating the same configuration steps across environments introduces human error. The
wp-cli.ymlconfiguration file standardizes and automates these workflows.
Core Highlights
- Safe search-replace with automatic handling of serialized data using
--preciseflag - Full database export and import with compression and filtering options
- Plugin and theme installation, activation, deactivation, and bulk updates
- User creation, role assignment, and bulk user management
- Post, page, and custom post type creation and manipulation
- Cron event listing, scheduling, and manual execution
- Object cache and transient flushing for performance troubleshooting
- Multisite network management including site creation and user assignment
How to Use It?
Basic Usage
The following examples demonstrate common WP-CLI operations:
## Export the database
wp db export backup.sql
## Import a database
wp db import backup.sql
## Safe search-replace across the database
wp search-replace 'http://old-domain.com' 'https://new-domain.com' --precise --all-tables
## Flush the object cache
wp cache flush
## List installed plugins
wp plugin listSpecific Scenarios
Database migration between environments: When moving a site from staging to production, export the staging database, transfer the file, import it on production, then run search-replace to update all URLs including those inside serialized data.
wp db export staging-dump.sql --add-drop-table
wp db import staging-dump.sql
wp search-replace 'https://staging.example.com' 'https://example.com' --precise --skip-columns=guidBulk plugin updates with verification: Update all plugins and confirm each update completed successfully.
wp plugin update --all
wp plugin list --update=availableReal-World Examples
A deployment script uses wp search-replace after each environment promotion to ensure no staging URLs remain in the production database. A scheduled cron script uses wp cron event run --due-now to trigger WordPress cron reliably from a system cron job rather than relying on visitor traffic. An agency uses a wp-cli.yml file to define the path and environment for each client site, allowing the same commands to run correctly across all accounts on a shared server.
Important Notes
Requirements
- WP-CLI must be installed and accessible in the execution environment, typically at
/usr/local/bin/wp - WordPress 6.9 or higher with PHP 7.2.24 or higher is required for full compatibility
- The executing user must have appropriate filesystem and database permissions for the target WordPress installation
- Database credentials must be correctly configured in
wp-config.phpfor database operations to succeed
FAQ
Q: How can I use WP-CLI commands with Happycapy Skills?
You can leverage the WP Wpcli And Ops Skill within Happycapy to execute WP-CLI commands for tasks like database export/import, plugin management, and user operations. This integration streamlines WordPress site management using Skills and the AI agent.
Q: Does this Skill support safe search-replace operations in WordPress databases?
Yes, the WP Wpcli And Ops Skill provides safe search-replace functionality via WP-CLI, ensuring your WordPress database updates are handled efficiently through Happycapy Skills.
Q: Can the AI agent automate WordPress cron jobs using this Skill?
The AI agent can utilize this Skill to manage and automate WordPress cron jobs, making scheduled tasks easier to handle directly from Happycapy.
Q: Is it possible to manage WordPress plugins and themes with this Skill?
Yes, this Skill allows you to install, activate, deactivate, and update WordPress plugins and themes using WP-CLI, all accessible through the Happycapy Skills interface.
Q: What types of WordPress content management tasks can the AI agent perform with this Skill?
With the WP Wpcli And Ops Skill, the AI agent can handle user management, content updates, and database operations, providing a comprehensive set of WordPress management tools within the Skills ecosystem.
More Skills You Might Like
Explore similar skills to enhance your workflow
GraphQL Schema Patterns
GraphQL queries, mutations, and code generation patterns. Use when creating GraphQL operations, working with Apollo Client, or generating types
Geo Content Optimizer
Optimize content for AI citations in ChatGPT, Perplexity, AI Overviews, Gemini, Claude. AI
Marketing Psychology
When the user wants to apply psychological principles, mental models, or behavioral science to marketing. Also use when the user mentions 'psychology,
Free Tool Strategy
When the user wants to build a free tool for marketing — lead generation, SEO value, or brand awareness. Use when they mention 'engineering as marketi
Blog Repurpose
Repurpose existing blog content into social posts, newsletters, and other formats
Spotify Player
Terminal Spotify playback/search via spogo (preferred) or spotify_player