Kualo / docs
On this page

Using WP-CLI

WP-CLI is a command-line tool for managing WordPress installations without touching the admin dashboard. It is pre-installed on all Kualo shared hosting accounts, so you can start using it as soon as you have SSH access.

7 min read Updated 9 Jun 2026

WP-CLI is a command-line tool for managing WordPress installations without touching the admin dashboard. It is pre-installed on all Kualo shared hosting accounts, so you can start using it as soon as you have SSH access.

Before you begin

You need an active SSH connection to your hosting account before running any WP-CLI commands. If you have not set that up yet, see our guide on using SSH on Kualo hosting.

You also need to know the path to your WordPress installation. If you installed WordPress in public_html, that is your working directory. If it lives in a subdirectory such as public_html/myblog, use that path instead.

Using the correct PHP binary

Kualo servers run CloudLinux with the PHP Selector, which means each account can run a different PHP version. The system php binary may not match the version you have chosen for your site, so you should always call WP-CLI using the PHP binary that matches your account's selected version.

To find the path to your account's PHP binary, run:

which php

On most Kualo accounts the CloudLinux PHP Selector puts the correct binary first in your PATH, so the output will be something like:

/usr/local/bin/php

You can confirm which version that resolves to with:

php -v

If the version shown does not match what you set in cPanel under Select PHP Version, open a fresh SSH session after saving your PHP version change - the CloudLinux PHP Selector updates your PATH automatically, so the php command in the new session will point to the correct version.

The simplest approach is to set your PHP version in cPanel first using the Select PHP Version tool, then open a fresh SSH session. The php command in that session will already point to the right version.

For the rest of this article, the examples use wp directly, which assumes your PATH is set correctly.

Running your first command

Change into the directory that contains your WordPress installation, then run a command. For example, to check the WordPress version:

cd ~/public_html
wp core version

If WP-CLI cannot find a wp-config.php file in the current directory, pass the path explicitly:

wp --path=/home/yourusername/public_html core version

Replace yourusername with your actual cPanel username.

Common use cases

Updating WordPress core

wp core update
wp core update-db

The second command updates the database schema after a core upgrade.

Checking and reinstalling WordPress core files

If you suspect core files have been modified or corrupted, you can verify their integrity and reinstall them without changing your version:

wp core verify-checksums

This checks every core file against the official WordPress checksums for your installed version. If any files fail the check, reinstall core at the same version to overwrite only the WordPress files (your themes, plugins, uploads, and wp-config.php are left untouched):

wp core download --version=$(wp core version) --force

You can also run an integrity check and reinstall directly from WP Toolkit in cPanel without using the command line. See our guide on checking WordPress integrity with WP Toolkit.

Managing plugins

List all installed plugins and their status:

wp plugin list

Install a plugin:

wp plugin install litespeed-cache --activate

Update a specific plugin:

wp plugin update litespeed-cache

Update all plugins at once:

wp plugin update --all

Deactivate and delete a plugin:

wp plugin deactivate hello-dolly
wp plugin delete hello-dolly

Managing themes

wp theme list
wp theme install astra --activate
wp theme update --all

Search and replace

Search and replace is one of the most useful WP-CLI commands, particularly when migrating a site to a new domain. It handles serialised data correctly, which a plain SQL find-and-replace in phpMyAdmin does not.

Always do a dry run first to see what would change:

wp search-replace 'http://old-domain.com' 'https://new-domain.com' --dry-run

If the output looks correct, run it for real:

wp search-replace 'http://old-domain.com' 'https://new-domain.com'

To skip specific tables, use the --skip-tables flag:

wp search-replace 'http://old-domain.com' 'https://new-domain.com' --skip-tables=wp_users

Search and replace writes directly to your database. Take a backup before running it on a live site. You can create one quickly using WP Toolkit's backup feature.

Flushing the cache

Flush the WordPress object cache:

wp cache flush

If you are using LiteSpeed Cache, you can also purge it via WP-CLI:

wp litespeed-purge all

For more on configuring LiteSpeed Cache with WordPress, see our LiteSpeed Cache configuration guide.

Managing users

List all users:

wp user list

Create a new admin user:

wp user create jane [email protected] --role=administrator

If you omit --user_pass, WP-CLI generates a strong random password and prints it once to the terminal. This is the recommended approach - the password is never typed into a command, so it's never written to your shell history.

If you need to set a specific password, prompt for it rather than typing it into the command:

read -rs WP_PASS
wp user create jane [email protected] --role=administrator --user_pass="$WP_PASS"
unset WP_PASS

read -rs takes the password as interactive input - hidden from the screen with -s, and read literally with -r — rather than as part of the command. The wp line only ever records $WP_PASS in your history, never its contents.

Anything you type directly into a command is saved to your shell history (usually ~/.bash_history) as a single line. This includes both --user_pass=MyPassword and prefixing the variable inline like WP_PASS=MyPassword wp ... — the whole line is recorded, password and all, so the inline prefix gives you no protection. Set the password with a separate read -rs step, or omit --user_pass entirely and let WP-CLI generate one.

Keeping a password out of history isn't the same as keeping it secret: while wp runs, the password is passed as an argument and is briefly visible in the process list (ps). On our servers, this is limited to the account itself, but for the strongest option prefer a generated password or reset via WP Toolkit in cPanel.

Reset a user's password the same way:

read -rs WP_PASS
wp user update jane --user_pass="$WP_PASS"
unset WP_PASS

Or use WP Toolkit in cPanel to reset passwords without touching the command line at all.

Updating the database after a migration

After moving a WordPress site, run the following to update the siteurl and home options and flush rewrite rules:

wp option update siteurl 'https://new-domain.com'
wp option update home 'https://new-domain.com'
wp rewrite flush

Managing cron events

List all scheduled cron events:

wp cron event list

Run all due cron events immediately:

wp cron event run --due-now

For more on WordPress cron, see our guide on disabling wp-cron.php and setting a real cron job.

Checking and repairing the database

wp db check
wp db repair
wp db optimize

Running WP-CLI commands from WP Toolkit

If you prefer not to use SSH, WP Toolkit in cPanel includes a built-in interface for running WP-CLI commands directly from your browser.

  1. Log in to cPanel and open WP Toolkit.
  2. Find the WordPress installation you want to manage and click on it to expand the details.
  3. Click the WP-CLI button (it may appear as a terminal icon or under a tools menu, depending on your WP Toolkit version [verify exact label]).
  4. A command input panel opens. Type your WP-CLI command without the leading wp, for example: plugin list.
  5. Click Run to execute the command. The output appears directly in the panel.

WP Toolkit automatically uses the correct PHP version and working directory for that installation, so you do not need to worry about paths or PHP binaries when running commands this way.

The WP Toolkit interface is a convenient way to run occasional commands, but SSH gives you more flexibility for scripting and bulk operations.

Troubleshooting

"Error: This does not seem to be a WordPress installation" You are not in the right directory. Use --path=/home/yourusername/public_html to point WP-CLI at the correct location.

"PHP Fatal error" or unexpected PHP version output Your PATH may be pointing to the system PHP rather than your account's selected version. Check the PHP version with php -v and compare it to what you have set in cPanel. Opening a fresh SSH session after changing the PHP version in cPanel usually resolves this.

Command hangs or times out Long-running commands such as a large search-replace can hit SSH idle timeouts. If this happens, consider running the command inside a screen or tmux session, or break the operation into smaller batches using the --tables flag.

If you get stuck, contact our support team and we will be happy to help.

Was this helpful?
Your feedback helps us find gaps in the docs.
Still need a hand?
Real people, around the clock - start a chat or open a ticket and we'll help you put it right.