MainWP includes WP-CLI integration for managing your Dashboard and child sites from the command line. This enables automation, scripting, and advanced management workflows.
What You’ll Learn
- Available WP-CLI commands for site management
- How to sync, update, and manage sites via command line
- Example automation scripts
Prerequisites
- MainWP Dashboard v4.1.3 or later
- WP-CLI installed on your Dashboard server
- Child sites connected to your MainWP Dashboard
For more information about WP-CLI, visit the official WP-CLI documentation.
Sites Management
Commands for managing multiple child sites simultaneously.List All Sites
Displays every child site in your MainWP installation.Count All Sites
Returns the total number of child sites.Connected Sites
Lists only child sites with active connections.Connected Sites Count
Returns count of actively connected child sites.Disconnected Sites
Lists child sites that are currently disconnected.Disconnected Sites Count
Returns count of disconnected child sites.Sync All Sites
Synchronizes data across all child sites.Check All Sites
Verifies the status of all child sites.Single Site Operations
Commands for managing individual child sites. Replace <id> with the site ID.Retrieves comprehensive data for a specific child site.Returns: site name, URL, WordPress version, PHP version, MainWP Child plugin version, PHP memory limit, MySQL version, active theme, and server IP address.Plugins
Themes
Updates & Status
Site Management
Add a new site:The CLI add-site command supports --uniqueid but does not accept an administrator password flag. Use this command when the child site requires Unique Security ID. If the child site requires Password Authentication, add the site through MainWP Dashboard or REST API with adminpassword.
Sync, reconnect, disconnect, or remove:Apply Updates
Update a specific item:Plugin & Theme Control
Manage plugins:Manage themes:Check HTTP Status
Verifies HTTP status of a child site.Updates Management
Commands for controlling plugin and theme updates across sites.View Available Updates
Shows all pending updates across all child sites.Ignored Updates (Global)
Lists globally ignored plugin or theme updates.Ignored Updates (Per Site)
Lists ignored updates for a specific child site.Ignore Updates Globally
Globally ignores an update across all sites.Ignore Updates on Specific Site
Ignores a specific update on one child site.Unignore Updates Globally
Reverses a global update ignore.Unignore Updates on Specific Site
Reverses a site-specific update ignore.
Example Workflows
Daily Sync Script
Create a script to sync all sites and check for updates:
Get Site Overview
Replace site IDs with your actual child site IDs. You can find site IDs by running wp mainwp sites --all-sites.
Self-Check Checklist