How to Downgrade WordPress Using WP-CLI

How to Downgrade WordPress Using WP-CLI

When you experience errors on WordPress after an update, you might need to downgrade WordPress, and one way to do this is by using WP-CLI.

Actually, this method of downgrading WordPress using WP-CLI is not only used for lowering the version, but you can also use it if you want to update WordPress to a specific version. For example, from version 6.0 to 6.3.

However, it is recommended to always update WordPress to the latest version, and it is highly discouraged to perform a downgrade unless there is an error that requires you to do so. This is because when there is a core update, there are definitely new features, as well as security and performance improvements.

If you still want to change the version and understand the risks, you can follow these steps.

How to Downgrade WordPress Using WP-CLI

Before proceeding, ensure that WP-CLI is already installed on the server or hosting you are using. If it is not, you can install it first by following the tutorial on This page.

Additionally, make sure you can access the server you are using to install WordPress via SSH.

Once it is installed, you can proceed to the process of downgrading WordPress using WP-CLI.

1. Open the WordPress Installation Folder

Opening the WordPress installation folder as referred to here is not done via FTP, File Manager, or Hosting, but through the CLI.

To open the installation folder, you can use the command cd. For example, if the installation folder is inside the folder cd web/wpgan.tld/public_html, then you can use the following command

cd web/wpgan.tld/public_html

2. Check the Installed WordPress Version

After being inside the path or WordPress installation folder, you can then check the installed WordPress version with the following command

wp core version

This check is necessary so you can confirm the current version and also the version after you perform the version change later.

For example, in this post, the version used is 6.5.3 and it will be changed to a lower version.

3. Find the WordPress Version to Use

To find the available WordPress versions that you can use, you can visit the WordPress release archive page here: https://wordpress.org/download/releases/

When you have determined the version you will use, for example 6.4.2, you can save that number to perform the version change later.

4. Downgrade WordPress Using WP-CLI

To the core of the discussion, now that everything is prepared, you can perform the downgrade with the command wp core update. However, because this will change it to a specific version, you need to add other parameters.

For example, to downgrade to version 6.4.2, you can use the following command

wp core update --version=6.4.2 --force

The additional ––force is necessary because we are performing a version change outside of the default command, so we need to force it to use the version we want.

When successful, the result will look more or less like this

5. Check the WordPress Version After Downgrade

Because the whole process is finished, you can check and confirm again whether the WordPress version has really been successfully changed or not using the following command

wp core version

When successful, the version displayed will be different from the version in step number 2 previously.

That is an easy way to downgrade or change the WordPress version to a specific version using WP-CLI, so you no longer need to use plugins or download the WordPress core manually again.

Written by

Muhammad Khoirun Nasikin

I enjoy tinkering with WordPress, hosting, VPS, web development, and various small experiments related to websites. I have over 3 years of experience in the web hosting industry.

COMMENTS

Loading...