WP-CLI is the official command-line tool for WordPress. Tasks that take many clicks in the dashboard, such as updating twenty plugins or replacing a domain in every table, take one command. It also works when the dashboard itself is broken.
Before you start
- SSH access to your cPanel account. You can use cPanel → Advanced → Terminal in the browser, or connect with an SSH client using keys from cPanel → Security → SSH Access.
- WP-CLI is available as the
wpcommand on MdmHost servers. Check withwp --info.
Go to the site folder
WP-CLI works on the WordPress install in the current folder:
cd ~/public_htmlAlternatively add --path=/home/user/public_html to any command.
Check the install
wp core version
wp plugin list
wp theme listplugin list shows each plugin's status and whether an update is available.
Updates
wp core update
wp core update-db
wp plugin update --all
wp theme update --allTake a backup first. You can update one plugin with wp plugin update woocommerce, or install a specific version with wp plugin install woocommerce --version=9.0.0 --force to roll back.
Plugins and themes
wp plugin deactivate --all
wp plugin activate classic-editor
wp theme activate twentytwentyfiveDeactivating everything is the fastest way to rule out a plugin conflict when the dashboard is unreachable. Plugins stay installed and keep their settings.
Users and passwords
wp user list --role=administrator
wp user update 1 --user_pass='New-Strong-Pass-2026'
wp user create alex alex@example.com --role=editorA password set this way appears in your shell history. Clear it with history -c afterwards or use --prompt=user_pass.
Database tasks
wp db export backup.sql
wp db import backup.sql
wp search-replace 'http://example.com' 'https://example.com' --all-tables --dry-runsearch-replace handles serialised data correctly, which a plain SQL query does not. Run it with --dry-run first to see how many replacements it would make. Store exports outside public_html so they cannot be downloaded.
Cache and cron
wp cache flush
wp litespeed-purge all
wp cron event list
wp cron event run --due-nowThe litespeed-purge command is available when the LiteSpeed Cache plugin is active.
Configuration
wp config list
wp config set WP_DEBUG true --raw
wp option get siteurlTroubleshooting
- "This does not seem to be a WordPress installation": you are in the wrong folder;
cdto wherewp-config.phplives. - PHP fatal error on every command: a plugin crashes on load. Add
--skip-plugins --skip-themesto the command. - Wrong PHP version: WP-CLI uses the command-line PHP. Check with
php -v; it can differ from the site's PHP selected in cPanel. - Memory errors: run with
php -d memory_limit=512M $(which wp) ....
Working with many sites
Resellers often host dozens of WordPress installs in separate cPanel accounts. Within one account you can loop over several installs with a short shell loop, for example running wp plugin update --all --path="$d" for each folder that contains a wp-config.php. Always run wp db export for each site first, and review the output for errors before moving on. Get help on any command with wp help plugin or wp help search-replace.
