WP-CLI is a very handy set of commands. You can run anything that you would run in wp-admin on a WordPress site but from the command line. Useful commands which WP-CLI employs to keep WordPress core updated plugins including the default themes which come with WordPress.
To run WP-CLI on Managed WordPress or Managed WooCommerce, you would need to obtain the SSH creds from the manager, by using the terminal or a command line program like Putty. You’ll then log in and change the home to HTML (which is where WordPress is installed). You have to be in this folder for WP-CLI to work.
Updating WordPress using WP-CLI
To update WordPress to the most current version, you can run this command, where you would replace out the X value with the current version number or WordPress.
To update WordPress to the most current version which is 5.0.3, run this command:
When WordPress 5.1 is released in February 2019, the command will be:
If an error does show whilst running the wp core update command (e.g., a WordPress update is already in progress in the terminal), a lock option value might be set. You can delete that option value by using this command:
Version of WordPress using WP-CLI
To verify the version of WordPress that is installed, you can run this command:
Updating Themes Using WP-CLI
Once you have updated WordPress, that will mean the default themes need to be updated as well. You can update those themes by using this command:
Updating Plugins Using WP-CLI
You can alternatively update both plugins from one command using:
Install Classic Editor using WP-CLI
If the site was on an older version of WordPress (such as 4.9.9) and you were updating to 5.0.3, but you wanted to keep using the classic editor and not the new default Gutenberg block editor, you can install and activate either the Classic Editor or Disable Gutenberg plugins.
To install and activate the Classic Editor plugin, you can run this command:
To install and activate the Disable Gutenberg plugin, use:
Using these commands in WP-CLI will make it easier to update WordPress, themes, plugins, and help you to install plugins from the command line without having to update from wp-admin. Managed WordPress and Managed WooCommerce will automatically update WordPress core, plugins and themes which are on WordPress.org.