WP-CLI on CloudSonic

Manage WordPress from the command line and automate updates, cache clears, and migrations in your deploy pipeline

TL;DR WP-CLI

WP-CLI is installed globally on every CloudSonic server so you can manage WordPress from the command line, run updates, clear caches, and automate tasks without touching the admin.

WP-CLI is the official command line interface for WordPress, installed globally on every CloudSonic server. It gives you full control over every WordPress installation from the command line, letting you update core, plugins, and themes, manage users, run database operations, clear caches, and automate any WordPress management task without using the admin interface. WP-CLI is particularly useful for integrating WordPress management into deployment scripts triggered by GitHub or GitLab CI/CD pipelines.

Prerequisites

WP-CLI for WordPress Management on CloudSonic

WP-CLI on CloudSonic is installed globally, meaning it is available from any directory on the server and can be run against any WordPress installation by specifying the path. Use it to update WordPress core, plugins, and themes in a single command, manage users, run database search and replace operations, import and export content, clear object caches, and automate any WordPress management task that would otherwise require the admin interface. WP-CLI is particularly powerful when integrated into GitHub Actions or GitLab CI deployment pipelines, allowing automated WordPress management tasks to run as part of every deployment without manual intervention.

Warning WP-CLI commands run as the server user and bypass WordPress authentication entirely, so restrict SSH access carefully and avoid running destructive WP-CLI commands without a recent backup in place.

Useful Commands

wp plugin update --all --path=/applications/your-site/public_html
wp cache flush --path=/applications/your-site/public_html
wp search-replace 'old-domain.com' 'new-domain.com' --path=/applications/your-site/public_html