WP CLI Commands to Quickly Update WordPress Sites (2025)

If you manage more than one WordPress site, clicking around the dashboard for every update gets old fast. That is where WP-CLI commands come in. You can update WordPress core, themes, and plugins straight from your terminal, with clear feedback and almost zero UI lag.

This guide walks through a practical workflow for updating everything from the command line. It assumes you are already comfortable with SSH and basic shell commands, and you want faster, safer updates for single or multiple sites.

By the end, you will have a repeatable routine for keeping WordPress 6.9 and your stack fully patched using WP-CLI only.

What Is WP-CLI and Why Use It for Updates?

WP-CLI is the WordPress Command Line Interface, a tool that lets you control almost every part of a site with terminal commands. Instead of logging into wp-admin, you run things like wp core update, wp plugin update, or wp theme update from your server.

For updates, WP-CLI has a few big advantages:

  • It is faster than the dashboard, especially on slow connections.
  • It is easy to script, so you can update several sites with one command sequence.
  • It prints clear success and error messages in the terminal.
  • It keeps working even when wp-admin is timing out or stuck in maintenance mode.

The core update commands live under wp core. Plugins use wp plugin, themes use wp theme. Around those you have helpers, like wp db for backups, wp maintenance-mode to hide changes during work, and wp config for quick debugging edits.

If you pair WP-CLI with a host that has good SSH access and performance, it becomes a very efficient maintenance toolkit. If you are still choosing a host, this top WordPress hosting providers comparison is a good place to see which plans support SSH and WP-CLI well.

When WP-CLI Updates Make More Sense Than the Dashboard

There are situations where using WP-CLI is not just “nice”, it is the only sane choice:

  • You manage many client sites, and logging into each dashboard would take all day.
  • You want automated deployments from Git, where updates happen as part of a script.
  • A web-based update is stuck, and the dashboard only shows a half-finished maintenance screen.
  • The site has dozens of plugins, and the updates page feels like a slot machine.
  • wp-admin does not load at all because of a broken plugin or theme.

With WP-CLI you can chain commands in a single line. For example, export the database, enable maintenance mode, run updates, then turn maintenance mode off again. That kind of repeatable flow is hard to match in the browser.

All WP CLI Commands

Just want a quick list of all WP-CLI commands? Well check them out in the list below.

CommandDescription
wp adminOpens the WordPress admin dashboard in your browser
wp cacheManage the object cache
wp capAdd, remove, or list user role capabilities
wp cliManage WP-CLI itself (info, update, aliases)
wp commentModerate and manage comments
wp configCreate or modify the wp-config.php file
wp coreInstall, update, or verify WordPress core
wp cronManage WP-Cron events
wp dbRun database operations like export, import, optimize
wp dist-archiveCreate a WordPress distribution archive
wp embedInspect or clear cached embeds
wp evalExecute arbitrary PHP code
wp eval-fileExecute a PHP file
wp exportExport WordPress content to WXR
wp findLocate WordPress installs on a system
wp helpDisplay help for WP-CLI commands
wp i18nTools for translation and localization
wp importImport content from WXR files
wp languageInstall and manage language packs
wp mediaImport and regenerate media files
wp menuCreate and manage navigation menus
wp networkManage multisite networks
wp optionGet, update, or delete site options
wp packageInstall and manage WP-CLI packages
wp pluginInstall, activate, update, or delete plugins
wp postCreate and manage posts and custom post types
wp post-metaManage post meta fields
wp post-typeList and manage post types
wp rewriteManage rewrite rules and permalinks
wp roleManage user roles
wp scaffoldGenerate plugin, theme, or block boilerplate
wp search-replaceSearch and replace content in the database
wp sidebarManage registered sidebars
wp siteManage individual sites in multisite
wp super-adminManage multisite super admins
wp taxonomyManage taxonomies
wp termCreate and manage taxonomy terms
wp themeInstall, activate, update, or delete themes
wp transientManage transients
wp userCreate, update, or delete users
wp user-metaManage user meta fields
wp widgetManage widgets

Before You Run WP-CLI Updates: Requirements and Safety Checks

Before you start firing off wp core update, take a minute to set the stage. A few basic checks will save you from ugly surprises.

Make Sure WP-CLI and WordPress Are Ready

First, confirm that WP-CLI is installed and usable:

  • Run wp --info or wp cli version. You should see details and a version number, such as WP-CLI 2.12.0.

If you get a “command not found” error, your host might not have WP-CLI installed, or it is not in your PATH. Many managed WordPress hosts ship it by default, while others need a manual install.

Next, make sure you are in the right directory. WP-CLI acts on the WordPress install in your current folder. That folder should contain wp-config.php.

For example:

  • cd /home/username/public_html
  • Or into a subfolder like /home/username/sites/client1/wordpress

On servers with cPanel or many installs, it is easy to land in the wrong document root. If you run updates from the wrong folder, you will update the wrong site.

Create a Quick Backup Before Updating

At a minimum, save a database backup before any major update. With WP-CLI, that is one simple command:

  • wp db export

This exports the database to a .sql file in the current directory. Many hosts also let you back up files via their panel or snapshots. That is ideal, but the database export is your “no excuses” safety net.

If you later need to roll back, you can restore it with:

  • wp db import backup-file.sql

You do not want your only restore option to be “hope the host has a nightly backup”.

Use Maintenance Mode and Staging Environments

Maintenance mode is handy when you are doing bulk updates or core upgrades:

  • Turn it on: wp maintenance-mode activate
  • Turn it off: wp maintenance-mode deactivate

For small plugin updates on a low-traffic site, you might skip maintenance mode. For big batches, it prevents visitors from hitting a half-updated state.

For serious sites, test large changes on a staging site or local clone first. That is especially true when you are also doing migrations or domain changes, like when you move from WordPress.com to self-hosted WordPress. Get things stable there, then repeat the same commands on production.

How to Update WordPress Core With WP-CLI

Core updates are the foundation. Once WordPress itself is current, theme and plugin updates tend to behave better.

Check Your Current Version and Available Core Updates

Start by seeing which version you are running:

  • wp core version

For more context on version checks, you can also review this guide on methods to check WordPress version.

To see if a newer version is available:

  • wp core check-update

If there is an update, it will show the new version (for example WordPress 6.9), the type of update, and a download URL. If not, you will see a message that you are already on the latest version.

Run a Safe WordPress Core Update From the Command Line

A basic, safe core update flow looks like this:

  1. wp db export
  2. wp maintenance-mode activate
  3. wp core update
  4. wp maintenance-mode deactivate

wp core update downloads and installs the latest stable WordPress version. After it finishes, WordPress might ask for a database update in the dashboard. From WP-CLI, you handle that with:

  • wp core update-db

That makes any schema changes the new version needs, so you do not get stuck on a “database update required” screen.

If you suspect something is off with core files after an update, run:

  • wp core verify-checksums

This compares your core files with the official checksums from WordPress.org and flags anything changed or missing. It is a quick way to spot hacked or corrupted files.

Update or Roll Back to a Specific WordPress Version

Sometimes you need to match a staging site or troubleshoot a plugin that only behaves on a certain version. In those cases you can set a specific core version with:

  • wp core update --version=6.0.3 --force

Replace 6.0.3 with the version you want. The --force flag tells WP-CLI to install that version even if you are already on a newer one.

Treat this like surgery:

  • Always have a fresh database export.
  • Prefer to test the change on staging first.
  • Keep a note of your previous version so you can move back if needed.

How to Update Plugins With WP-CLI Commands

Plugins are where things break most often, so having fast control over them from the terminal is a big win.

See Which Plugins Need Updates in One Command

Get a full plugin overview with:

  • wp plugin list

You will see each plugin name, status (active or inactive), version, and whether an update is available.

To focus only on plugins that need updates, use:

  • wp plugin list --update=available

To see only active plugins with updates:

  • wp plugin list --status=active --update=available

This beats clicking around multiple pages in the dashboard, especially on large sites or slow admin panels.

Update One or All Plugins From the Terminal

You can update a single plugin by its slug:

  • wp plugin update jetpack

The slug is the folder name shown in wp plugin list, and it usually matches the last part of the plugin’s WordPress.org URL.

To update every plugin in one go:

  • wp plugin update --all

On production, a nice pattern is:

  • Update a few key plugins one by one and spot-check the site.
  • Then run wp plugin update --all for the rest.

That gives you a better sense of which change broke something if a problem shows up.

Fix Common Plugin Problems After an Update

If a plugin update breaks the site, you can quickly deactivate that single plugin:

  • wp plugin deactivate jetpack

If the site is completely white-screened and you are not sure which plugin is at fault, you can deactivate all of them:

  • wp plugin deactivate --all

After that, reactivate plugins one by one with wp plugin activate plugin-slug until the issue reappears.

When even running WP-CLI seems to hit fatal errors from theme or plugin code, add these global flags to commands:

  • --skip-plugins
  • --skip-themes

For example:

  • wp --skip-plugins --skip-themes plugin deactivate problem-plugin

That lets you bypass broken code long enough to clean it up.

How to Update Themes With WP-CLI Commands

Themes can be just as dangerous as plugins after an update, especially if there are direct edits or old code involved. WP-CLI makes it easier to see what is going on and recover fast.

List Installed Themes and Find What Needs Updating

To see all installed themes:

  • wp theme list

You will get each theme’s name, status (active or inactive), version, and update status. To focus on themes that have updates available:

  • wp theme list --update=available

This is handy when you manage a stack with several child themes, or when you want to double-check that old default themes are not quietly out of date.

Update Single Themes or Run Bulk Theme Updates

To update one theme by slug:

  • wp theme update twentytwentytwo

To update every theme at once:

  • wp theme update --all

Be a little more cautious with your active theme, especially if it is not a child theme and you have made custom edits. A good habit is to keep custom work in a child theme, then update the parent with WP-CLI.

Switch Themes or Recover From a Broken Theme Update

If a theme update breaks the front end or wp-admin, switch to a default theme:

  • wp theme activate twentytwentyfive

Combine that with the skip flags if needed:

  • wp --skip-plugins --skip-themes theme activate twentytwentyfive

Once the site is reachable again, you can inspect logs, roll back files from backup, or reinstall the problem theme in a safer environment.

Building a Repeatable WP-CLI Update Workflow

The real power of WP CLI commands shows up when you turn them into a simple, repeatable routine. Over time, that routine becomes muscle memory.

If you enjoy automating tasks and working with code, pairing this with things like programmatic post creation in WordPress can give you a full dev-style workflow around your sites.

Sample Step-by-Step Update Routine You Can Reuse

Here is a compact routine you can follow for most maintenance windows:

  1. SSH into your server.
  2. cd into the correct WordPress directory that holds wp-config.php.
  3. Export the database with wp db export.
  4. Activate maintenance mode with wp maintenance-mode activate.
  5. Check core updates with wp core check-update. If an update exists, run wp core update, then wp core update-db if needed.
  6. List plugins with wp plugin list --update=available, then run wp plugin update --all.
  7. List themes with wp theme list --update=available, then run wp theme update --all.
  8. Optionally verify core files with wp core verify-checksums.
  9. Turn maintenance mode off with wp maintenance-mode deactivate.
  10. Load the front end and wp-admin in your browser and do a quick click-through.

You can paste a trimmed version of this into a shell script or your personal notes and adjust it per project.

Tips for Safer and Faster Command Line Updates

A few habits make WP-CLI updates much smoother:

  • Test big changes on staging first, especially major core releases or heavy plugins like page builders.
  • Run updates during low-traffic hours, so visitors are less likely to hit maintenance mode.
  • Keep WP-CLI itself current with wp cli update, so you get new commands and better dependency checks.
  • For migrations and domain changes, learn wp search-replace so you can update old URLs in the database without manual edits.
  • After each maintenance run, clear any caching layer and do a quick health check of key pages, logins, and forms.

Over time, you will build your own variations on this flow, but the basics stay the same: backup, update, verify, test.

Conclusion

Using WP CLI commands for updates gives you speed, control, and a clear way to recover if something goes wrong. Instead of hunting through menus, you run a short sequence, read the output, and know exactly what happened.

If you are new to WP-CLI, start with safe, read-only commands like wp core version, wp plugin list, and wp theme list. Once those feel comfortable, layer in database exports, maintenance mode, then core, plugin, and theme updates.

Stick this routine on your calendar as a regular maintenance task, and your sites will stay more secure, more stable, and a lot easier to manage over time.

Picture of Andy Feliciotti

Andy Feliciotti

Andy has been a full time WordPress developer for over 10 years. Through his years of experience has built 100s of sites and learned plenty of tricks along the way. Found this article helpful? Buy Me A Coffee

Leave a Reply

Your email address will not be published. Required fields are marked *

WordPress Tips Monthly
Get the latest from SmartWP to your inbox.