+254725682556 +254725052660 [email protected]
Client Area

WordPress

How to Use WP-CLI to Manage Your WordPress Site via SSH

WP-CLI is a command-line tool that lets you manage a WordPress site without clicking through wp-admin. You can update plugins, reset a password, or run a database search-replace with a single command, which is often faster than the equivalent task in the dashboard, especially if wp-admin is slow or you're locked out of it.

What You Need Before You Start

WP-CLI is pre-installed on ZIPROF shared hosting accounts that have SSH access turned on, so you shouldn't need to install anything yourself.

How to Connect and Confirm WP-CLI Is Available

  1. Connect to your hosting account over SSH using the host, username, and port from your welcome email or control panel.
  2. Move into your WordPress site's folder, for example cd public_html (or the subfolder your site lives in if it's installed in an addon domain or subdomain).
  3. Run wp --info. If WP-CLI is working, this prints the PHP version, WP-CLI version, and the path it's running from.
If you get a "command not found" error, double-check you're in the correct directory and that your account actually has SSH access enabled. If it still doesn't work, contact support.

Commands You'll Use Most Often

Once you're in your site's folder, here are the commands that cover most day-to-day tasks:

  • wp core update: updates WordPress core to the latest version.
  • wp plugin update --all: updates every installed plugin in one go.
  • wp theme update --all: updates every installed theme.
  • wp plugin list: shows every installed plugin and whether it's active.
  • wp user list: shows every WordPress user account on the site.
  • wp user update <username> --user_pass=<newpassword>: resets a user's password, which is handy if you're locked out of wp-admin entirely.
  • wp cache flush: clears any object cache the site is using.

Updating Everything in One Step

If you just want to bring a site fully up to date, run these three commands one after another:

  1. wp core update
  2. wp plugin update --all
  3. wp theme update --all

This is useful on a site with dozens of plugins, since it skips the back-and-forth of updating each one individually in wp-admin.

Running a Database Search-Replace

A common use of WP-CLI is fixing URLs stored in the database, for example after moving a site to a new domain. The command is:

wp search-replace 'olddomain.com' 'newdomain.com'

Take a full backup of your database before running a search-replace. It edits the database directly and there's no undo once it's done. Add --dry-run to the end of the command first to preview what would change without actually making the change.

Why This Is Worth Learning

None of this replaces wp-admin for day-to-day editing, but WP-CLI is a genuine time-saver for repetitive maintenance tasks, and it still works when wp-admin itself is broken or unreachable, such as during a white screen of death or a lockout. If you'd rather not work from the command line at all, you can do most of the same updates and password resets from the WordPress dashboard instead, just at a slower pace.