Update WordPress Via WP-CLI

Updating WordPress via the CLI is pretty easy.

First make sure you have wp-cli installed. I’ll use my Linode as an example.

# wget https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
--2021-08-02 03:09:12--  https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.108.133, 185.199.109.133, 185.199.110.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.108.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 6094557 (5.8M) [application/octet-stream]
Saving to: ‘wp-cli.phar’

wp-cli.phar    100%[===========>]   5.81M  --.-KB/s    in 0.04s

2021-08-02 03:09:12 (140 MB/s) - ‘wp-cli.phar’ saved [6094557/6094557]

# chmod +x wp-cli.phar

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

Then it’s as simple as this:

# /usr/local/bin/wp core update

Updating to version 5.8 (en_US)...
Downloading update from https://downloads.wordpress.org/release/wordpress-5.8-no-content.zip...
Unpacking the update...
Cleaning up files...
File removed: wp-includes/css/dist/editor/editor-styles-rtl.css
File removed: wp-includes/css/dist/editor/editor-styles-rtl.min.css
File removed: wp-includes/css/dist/editor/editor-styles.css
File removed: wp-includes/css/dist/editor/editor-styles.min.css
4 files cleaned up.
Success: WordPress updated successfully.