Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Common WP-CLI commands to update WordPress

This guide lists simple WP-CLI commands that update WordPress core, plugins and themes from the command line.

WordPress2 min read10 steps

What is WP-CLI?

WP-CLI is a tool that lets you manage WordPress by typing commands instead of clicking in the dashboard. CLI means command line interface. That is a screen where you type instructions as text. It is fast, and it works even when the dashboard is broken.

You need SSH access to use it. SSH is a safe way to connect to your server and type commands. Ask Hostvento support if WP-CLI is installed on your plan. To check, type wp --info.

Warning: updates can break a site if a plugin or theme does not match the new version. Always take a backup of your files and database first.

Steps

  1. Connect to your server with SSH.
  2. Go to your WordPress folder. It is often public_html:
    cd ~/public_html
    This moves you into that folder.
  3. Back up the database:
    wp db export backup.sql
    This saves your database into a file called backup.sql.
  4. Check your current version:
    wp core version
    This prints the WordPress version number.
  5. See if a core update exists:
    wp core check-update
    This lists newer versions, if any.
  6. Update WordPress core:
    wp core update
    This downloads and installs the newest version.
  7. Update the database after a core update:
    wp core update-db
    This makes sure the database matches the new version.

Plugin commands

wp plugin list

This shows all plugins and tells you which have updates.

wp plugin update akismet

This updates one plugin. Replace akismet with the plugin's name.

wp plugin update --all

This updates all plugins at once.

Theme commands

wp theme list

This shows all themes and their update status.

wp theme update --all

This updates every theme.

Other handy commands

wp core verify-checksums

This checks that your core files have not been changed or damaged.

wp cache flush

This clears the object cache. A cache is a saved copy that makes your site faster.

After updating

  1. Open your site and click through the main pages.
  2. Log in to the dashboard and check for notices.
  3. If something broke, restore your backup, or turn off the last plugin you updated with wp plugin deactivate plugin-name.
Tip: If you run these commands as the root user, WP-CLI warns you. Add --allow-root only if you understand why. Usually, use your normal account.

Quick recap

  • WP-CLI manages WordPress from the command line over SSH.
  • Back up first with wp db export.
  • Use wp core update, wp plugin update --all and wp theme update --all.
  • Test your site after every update.