Mumbai & Delhi datacenters 99.9% uptime SLA
All systems operational New Build a website with AI
Navigation
AI Website Builder New Pricing About Documentation Support Center Get Started Login
ALL SYSTEMS OPERATIONAL
WordPress

WP-CLI Guide: Manage WordPress From the Command Line

Getwebup 5 min read

If you're still clicking through wp-admin to update plugins one at a time, or writing raw SQL to fix a URL after a migration, WP-CLI will save you a stupid amount of time. It's the command-line tool for WordPress, and once it's set up on your Getwebup account, most routine maintenance takes seconds instead of minutes.

What WP-CLI Actually Is

WP-CLI is a command-line interface for WordPress. Instead of logging into wp-admin, clicking around, and waiting for pages to load, you run a single command from the terminal: update core, update every plugin, search-replace a domain across the whole database, reset a locked-out admin's password, export the database — all without a browser.

It's the same tool developers use to script deployments and staging refreshes. You don't need to be a developer to use it. You just need terminal access and a handful of commands you'll reuse constantly.

Getting Access: cPanel Terminal or SSH

You have two ways in, depending on your plan:

  • Shared/cPanel hosting — use cPanel's built-in Terminal app (search "Terminal" in cPanel). It runs in a jailed shell but supports WP-CLI fine.
  • VPS — SSH in as usual: ssh user@your-server-ip.

Once you're in, cd into the WordPress install directory — usually public_html or public_html/yourdomain.com for addon domains:

cd ~/public_html

Checking If It's Already Installed

Most Getwebup cPanel and VPS environments ship with WP-CLI preinstalled. Check first:

wp --info

If you see version info and PHP details, you're set — skip to the commands section. If you get -bash: wp: command not found, install it manually below.

Installing WP-CLI (If It's Missing)

This takes under a minute on both cPanel Terminal and a VPS:

curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
mv wp-cli.phar ~/bin/wp   # or wherever's in your PATH
wp --info

On a VPS where you have root, you can install it system-wide instead so every account can use it:

sudo mv wp-cli.phar /usr/local/bin/wp

On shared cPanel hosting you're jailed to your own home directory, so ~/bin (added to your PATH in .bashrc) is the right spot.

The Commands You'll Actually Use

You don't need to memorize the full command reference. In practice, 90% of the work is these:

TaskCommand
Update WordPress corewp core update
Update all pluginswp plugin update --all
List plugins with available updateswp plugin list --update=available
Reset an admin passwordwp user update admin --user_pass=NewPass123!
Search and replace a URL across the DBwp search-replace 'oldsite.com' 'newsite.com' --all-tables
Export the databasewp db export backup.sql
Flush and regenerate permalinkswp rewrite flush
Deactivate every plugin (recovery)wp plugin deactivate --all
Run pending cron events manuallywp cron event run --due-now
Check current WordPress versionwp core version

A Real Example: Cleaning Up After a Migration

Say you've just moved a site to Getwebup and the URLs are still pointing at the old domain — broken images, wrong login redirects, the usual mess. Instead of hand-editing the database, do a dry run first so you can see what would change without touching anything:

wp search-replace 'http://oldsite.com' 'https://newsite.com' --all-tables --dry-run

Review the count of replacements it reports. If it looks right, drop --dry-run and run it for real. This handles serialized data correctly, which a plain SQL find-and-replace does not — that's the part that usually breaks widgets and page builder layouts when people try to do it by hand.

Common Errors and What They Mean

"Error: This does not seem to be a WordPress installation"

You're in the wrong directory, or WordPress core files aren't where WP-CLI expects them. Run wp --path=/home/username/public_html core version to point it at the right folder explicitly.

"-bash: wp: command not found" after installing

The binary isn't in your PATH. Either move it to a directory that already is (like ~/bin on cPanel, if that's listed in .bashrc), or run it with the full path: /home/username/bin/wp --info.

"PHP Fatal error" or blank output when running a command

WP-CLI uses the PHP CLI binary, which can be a different version from the one your site runs under in cPanel's MultiPHP Manager. Check with wp cli info — if the PHP version listed doesn't match what your site needs, you'll need to point WP-CLI at the right PHP binary or adjust it via cPanel.

Command hangs or times out on a large site

Big search-replace or export jobs on databases with tens of thousands of rows can take a while over a jailed shell. Run them inside screen or tmux so the process survives if your SSH session drops:

screen -S wpcli
wp search-replace 'old.com' 'new.com' --all-tables
# Ctrl+A then D to detach, screen -r wpcli to reattach

Automating Routine Maintenance With Cron

Once you're comfortable with the commands, you can schedule them through cPanel's Cron Jobs so updates happen without you logging in at all:

cd /home/username/public_html && /home/username/bin/wp plugin update --all --quiet

Set this to run weekly, and pair it with an automated database export beforehand so a bad plugin update is never more than a restore away.

Prevention: Don't Let CLI Speed Skip Safety

WP-CLI is fast enough that it's tempting to skip the caution you'd normally use in wp-admin. Don't.

  • Always run a full backup (wp db export plus a files backup) before core update, bulk plugin updates, or any search-replace.
  • Use --dry-run on search-replace every time before committing to it.
  • Test destructive commands on a staging copy first if the site is business-critical — Getwebup's cPanel staging tool makes this a two-minute step.
  • Avoid running WP-CLI as root on a VPS if the site files are owned by a different user — it'll change file ownership and cause permission errors afterward.

Once it's part of your routine, WP-CLI turns maintenance that used to eat twenty minutes of clicking into a single command you can paste and forget. If you get stuck on a specific command or an install won't cooperate, Getwebup support can walk through it with you over a ticket.

Frequently asked questions

Do I need SSH access to use WP-CLI, or does cPanel Terminal work?

cPanel's built-in Terminal app works fine for WP-CLI — you don't need full SSH. It runs in a restricted (jailed) shell, but all standard wp commands run normally inside it.

Is WP-CLI already installed on Getwebup hosting?

Most cPanel and VPS environments come with it preinstalled. Run wp --info to check. If it's missing, installing it manually takes under a minute using the commands in this guide.

Can WP-CLI break my site if I run the wrong command?

Yes — commands like search-replace and core update change your database and files directly, with no confirmation dialog. Always back up first and use --dry-run on search-replace before running it for real.

Why does WP-CLI say I'm not in a WordPress installation when I am?

You're likely one directory off — check with pwd and ls for wp-config.php, or pass --path explicitly, e.g. wp --path=/home/username/public_html core version.

Can I automate plugin updates with WP-CLI?

Yes. Schedule a cPanel cron job that runs wp plugin update --all on a fixed interval. Pair it with an automated wp db export beforehand so you always have a fast rollback point.

#wp-cli #wordpress #cpanel-terminal #ssh #command-line #automation

Keep reading

Chat with Support