10-19-2026, 02:41 PM
WP-CLI on CloudPanel: manage WordPress from the command line
WP-CLI lets you do WordPress jobs by typing short commands instead of clicking through wp-admin. Updating every plugin, resetting a forgotten admin password or changing your domain in the whole database takes one line. It's also a lifesaver when wp-admin itself is broken and you can't log in.
This guide shows the commands you'll actually use, explained in plain words.
Before you start: log in as the site user
Always run WP-CLI as the site's own user, never as root. That way new files get the right owner and you don't create permission problems.
Every command below is run from this folder (the one that contains wp-config.php).
Check that WP-CLI is available:
If you see "command not found", ask the server admin to install it as root:
See what's going on
Update everything safely
Take a quick database backup first, then update:
If something breaks after an update, you can roll a single plugin back to a version you know works:
Fix a site that won't load
A broken plugin is the most common cause of a white screen. Turn off all plugins at once, check the site, then turn them on one by one:
Switch to a default theme if the theme is the problem:
Reset a forgotten admin password
Replace with your username (see ). Or create a fresh admin user:
WP-CLI prints the new password on screen.
Change the domain (or move from HTTP to HTTPS)
WordPress stores your address in many places in the database. This command replaces it everywhere safely. Always test with first, which only shows what would change:
Then clear your caches (next section).
Clear caches
If you use Varnish in CloudPanel, also purge it from the site's Varnish Cache tab.
Back up and restore the database
Keep backups outside the htdocs folder (like the home folder above), so nobody can download them from the web.
Run WordPress cron reliably
WordPress normally runs its scheduled jobs only when someone visits the site. On quiet sites, scheduled posts and emails can be late. You can run them on a timer instead:
to check it; on most servers it's .
Quick reference
Sources (checked October 2026): WP-CLI official site · WP-CLI command reference
Related: Install WordPress in CloudPanel
WP-CLI lets you do WordPress jobs by typing short commands instead of clicking through wp-admin. Updating every plugin, resetting a forgotten admin password or changing your domain in the whole database takes one line. It's also a lifesaver when wp-admin itself is broken and you can't log in.
This guide shows the commands you'll actually use, explained in plain words.
Before you start: log in as the site user
Always run WP-CLI as the site's own user, never as root. That way new files get the right owner and you don't create permission problems.
Code:
ssh site-user@YOUR_SERVER_IP
cd ~/htdocs/www.example.comCheck that WP-CLI is available:
Code:
wp --infoCode:
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
mv wp-cli.phar /usr/local/bin/wpSee what's going on
Code:
wp core version # which WordPress version you run
wp plugin list # all plugins, active or not, and if updates are waiting
wp theme list # all themes
wp user list # all users and their rolesUpdate everything safely
Take a quick database backup first, then update:
Code:
wp db export ~/backup-before-update.sql
wp core update
wp plugin update --all
wp theme update --all
wp core update-dbCode:
wp plugin install woocommerce --version=9.0.0 --forceFix a site that won't load
A broken plugin is the most common cause of a white screen. Turn off all plugins at once, check the site, then turn them on one by one:
Code:
wp plugin deactivate --all
wp plugin activate contact-form-7Code:
wp theme activate twentytwentyfiveReset a forgotten admin password
Code:
wp user update admin --user_pass='a-new-long-password'Code:
adminCode:
wp user listCode:
wp user create newadmin [email protected] --role=administratorChange the domain (or move from HTTP to HTTPS)
WordPress stores your address in many places in the database. This command replaces it everywhere safely. Always test with
Code:
--dry-runCode:
wp search-replace 'http://old-domain.com' 'https://www.new-domain.com' --dry-run
wp search-replace 'http://old-domain.com' 'https://www.new-domain.com'Clear caches
Code:
wp cache flush # WordPress object cache
wp transient delete --all # old temporary data
wp rewrite flush # refresh permalinksBack up and restore the database
Code:
wp db export ~/site-$(date +%F).sql # backup with today's date
wp db import ~/site-2026-10-19.sql # restore a backupRun WordPress cron reliably
WordPress normally runs its scheduled jobs only when someone visits the site. On quiet sites, scheduled posts and emails can be late. You can run them on a timer instead:
- Add this line to wp-config.php, above "That's all, stop editing":
Code:define( 'DISABLE_WP_CRON', true ); - In CloudPanel, open the site's Cron Jobs tab and add a job that runs every 5 minutes with this command:
Code:cd /home/site-user/htdocs/www.example.com && /usr/local/bin/wp cron event run --due-now >/dev/null 2>&1
Code:
which wpCode:
/usr/local/bin/wpQuick reference
- : see all pluginsCode:
wp plugin list
- : update all pluginsCode:
wp plugin update --all
- : emergency switch-offCode:
wp plugin deactivate --all
- : reset a passwordCode:
wp user update NAME --user_pass='...'
- : preview a domain changeCode:
wp search-replace OLD NEW --dry-run
- : database backupCode:
wp db export file.sql
- : clear the object cacheCode:
wp cache flush
Sources (checked October 2026): WP-CLI official site · WP-CLI command reference
Related: Install WordPress in CloudPanel

