Website Development

How to Update WordPress, Plugins and Themes Using WP-CLI

WP-CLI is a command line tool that allows you to manage a WordPress website without logging in to the WordPress dashboard. It is useful for checking website details, updating WordPress core, updating plugins and themes, clearing cache, and reinstalling WordPress core files.

Before running updates, it is recommended to make a full backup of the website files and database.

Check Current Directory

pwd

List files:

ls

See Directories / Also if you wish to change directory use command cd

dir

Check is WP installed

wp core version && wp option get blogname

After you’ve done these checks

You can see also config file

wp config list

Updated WordPress

wp core update

Update database if needed:

wp core update-db

Update plugins:

wp plugin update --all

Update Themes

wp theme update --all

Clear cache after update:

wp cache flush

Also to update with one command

wp core update && wp plugin update --all && wp theme update --all

Reinstall WordPress

To reinstall WordPress through WP-CLI, you’ll just need to enter the following command:

wp core download --skip-content --force

This will reset your WordPress installation without affecting your themes and plugins. 

To top