Knowledge Base
MilesWeb / WordPress FAQ

Common Commands Used To Update WordPress Using WP-CLI

Approx. read time : 2 min

WP-CLI is a set of commands that can be used very easily. It allows you to run everything in wp-admin on a WordPress site but by using the command line. In order to run WP-CLI on Managed WordPress, you need to first obtain the SSH creds from the manager, with help of terminal or a command-line program like Putty. Then log in and change the home to HTML (where WordPress is installed). To work with WP-CLI you need to be present in this folder.

To update WordPress using WP-CLI

In order to update WordPress to the latest version, you need to run the following command.

Note:  You will have to replace the X value with the current version number or WordPress.

For example, in order to update WordPress to the most current version which is 5.0.3, run the following command :

If you wish to update with the 5.1 version, then your command will be :

If any error occurs while running the wp core update command (like WordPress update is already in progress in the terminal), then a lock option value might be set. SO, you can delete that option value by using the following command :

WordPress version using WP-CLI

Run following command, to verify the version of WordPress that is installed :

Updating theme using WP-CLI

After updating WordPress, the next step is to update the default themes as well. By using the following command you can update those themes:

In the above command, the themes updated would be Twenty Sixteen, Twenty Seventeen, and Twenty Nineteen.

Plugins updation using WP-CLI

If you have Akismet or Jetpack plugins installed, then you can update those two plugins by running either of the following commands :

Alternatively, you can update both plugins using one following command :

Installing Classic Editor using WP-CLI

If your site was on an older version of WordPress (like 4.9.9) and you wish to update it to 5.0.3, but at the same time if you want to keep using the classic editor and not the new default Gutenberg block editor, then you can install and activate either the Classic Editor or Disable Gutenberg plugins.

Run the following command, to install and activate the Classic Editor plugin :

Run following command, to install and activate the Disable Gutenberg plugin :

With the use of all these commands in WP-CLI it will become easy for you to update WordPress, themes, plugins, and also helps you to install plugins from the command line without having to update from wp-admin.

Also Read :

 Learn to stage a WordPress website using Softaculous in cPanel

 How To Fix RSS Feed Errors In WordPress?

 How to Create a Landing Page in WordPress?

Sonam Wagh
With an interest in doing something creative daily, Sonam works as a Digital Marketing Executive. She likes to write technical blogs related to web hosting, digital marketing, and other IT topics. She also likes to spend her leisure time on social media to find different strategies for client engagement.
Need help? We’re always here for you.
Register Your Free Domain Name
OFFER EXPIRES IN
04
min
59
sec