Use WP-CLI to Update WordPress core

WP-CLI is an open-source command-line tool that allows you to manage your WordPress website directly from the terminal. With it, you can easily update WordPress to the latest release or to a specific version.
Steps to update WordPress with WP-CLI
SSH to your server, and use this command to check if you have WP-CLI installed:
wp --info
If WP-CLI is not installed, follow this tutorial to install it.
Then use cd
command to navigate to the WordPress installation directory, for example:
cd /var/wwww/public/wordpress
Use this command to check for latest update:
wp core check-update
Use this command to update to the latest version:
wp core update
Or if you want to update to the specific version instead of the latest one, use this command (input the version after the --version=
parameter):
wp core update --version=6.8.1
The terminal will download and install the WordPress update for you. Once the update is complete, run the following command to update the database:
wp core update-db
And another command to flush the cache:
wp cache flush
Done.