Ultra Web Hosting Docs

Using WP-CLI

WP-CLI is the command-line interface for WordPress. Over SSH it lets you update plugins, edit the database, reset passwords, and run maintenance tasks far faster than clicking through the dashboard — and without a browser at all.

Running WP-CLI

WP-CLI commands must be run from inside your WordPress installation, so first connect over SSH (see SSH Access) and change into the site's document root:

cd ~/public_html
wp core version

If that prints a version number, WP-CLI is working and found your WordPress install. Every command is run from the docroot so WP-CLI can read wp-config.php and connect to your database.

Note Depending on the server, WP-CLI may be available simply as wp, or you may need to call the downloaded phar directly with php wp-cli.phar. If wp is not found, run php wp-cli.phar core version from the directory where the phar lives.

Inspecting the Site

Start by checking what is installed and what needs attention:

wp core version
wp plugin list
wp theme list
wp core check-update

The wp plugin list output shows each plugin's status and whether an update is available — a quick way to audit a site before you touch it.

Updating Plugins and Core

Keeping WordPress current is one of the biggest wins WP-CLI offers. Update everything in one pass:

wp plugin update --all
wp theme update --all
wp core update
Tip Export a database backup with wp db export before running bulk updates, so you can roll back instantly if an update breaks the site.

Search and Replace (Fixing URLs)

When you move a site to HTTPS, migrate a domain, or clone a site, URLs stored in the database need updating. WP-CLI handles this safely, including inside serialized data:

wp search-replace 'http://old' 'https://new'

Always run it as a dry run first to see how many rows would change, then run it for real:

wp search-replace 'http://old' 'https://new' --dry-run
wp search-replace 'http://old' 'https://new'
Tip This is the cleanest fix for mixed-content warnings after switching to SSL, because it rewrites hard-coded http:// URLs throughout the database. See Fixing Mixed Content for the full walkthrough.

Managing Users and Caches

Locked out of the admin? Reset a password from the command line, no email required:

wp user update admin --user_pass=NEW

After configuration changes or a stubborn caching issue, flush the object cache:

wp cache flush
Warning Replace admin with the real username and NEW with a strong password. The wp user update command changes the password immediately for everyone who uses that account.

Exporting the Database

Create a portable SQL dump of the whole WordPress database with a single command:

wp db export
wp db export mybackup.sql

Without a filename, WP-CLI writes a timestamped .sql file into the current directory. This is ideal for taking a quick snapshot before risky changes, or for moving a site to another host.

Note If a command reports the wrong PHP version, prefix it with the CloudLinux PHP Selector's matching binary, for example ea-php82 wp-cli.phar plugin list. If you cannot get WP-CLI running at all, open a support ticket.