![]() |
|
Guide WP-CLI on CloudPanel: Manage WordPress from the Command Line - Printable Version +- AdminsForum (https://adminsforum.com) +-- Forum: Free & open-source control panels (https://adminsforum.com/Forum-free-open-source-control-panels) +--- Forum: CloudPanel (https://adminsforum.com/Forum-cloudpanel) +---- Forum: CloudPanel Guides & Tutorials (https://adminsforum.com/Forum-cloudpanel-guides-tutorials) +----- Forum: CloudPanel WordPress Guides (https://adminsforum.com/Forum-cloudpanel-wordpress-guides) +----- Thread: Guide WP-CLI on CloudPanel: Manage WordPress from the Command Line (/Thread-guide-wp-cli-on-cloudpanel-manage-wordpress-from-the-command-line) |
WP-CLI on CloudPanel: Manage WordPress from the Command Line - JAY - 10-19-2026 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. 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:
Code: which wpCode: /usr/local/bin/wpQuick reference
Sources (checked October 2026): WP-CLI official site ยท WP-CLI command reference Related: Install WordPress in CloudPanel |