1. Why You Need Older WordPress Versions
Of course, running the latest version of WordPress is the best option for any website, but at times, there could be specific scenarios that may require working with an ‘older’ version of WordPress.
For example, a very common scenario is when you may want to test a WordPress version upgrade on your localhost or dev/staging environment before upgrading the live environment. Similarly, there could be a variety of other reasons for installing older WordPress versions.
In our earlier article, we already saw How To Install WordPress Locally using XAMPP, however, the installation steps discussed in that post do not apply to installing an ‘older’ WordPress version. By older we mean WordPress version 5.6 and above.
Hence, in this article, we will specifically go through the steps for installing WordPress version 5.6 and above, locally on Windows using XAMPP.
2. Why Installation Ends Up As Latest Version
Though installing WordPress locally using XAMPP is a fairly simple process, however, when installing any WordPress versions starting WordPress 5.6, there is a catch!
The catch is the ‘automatic-update’ feature of WordPress, which is ‘ON’ by default since v5.6, and that is the reason for users starting out the WordPress installation using older WordPress versions (> v5.6 but not the latest) but still ending up with the latest WordPress version soon after the installation process.
Because by the time installation using an older version is completed, in the backend WordPress automatically upgrades the core version to the latest available version at the time. Of course, for this to happen your localhost needs an active internet connection.
3. WordPress Automatic Update Feature
There are four types of WordPress updates:
- Core updates
- Plugin updates
- Theme updates
- Translation file updates
The Core updates are further subdivided into three types:
- Core development updates
- Minor core release updates
- Major core release updates
The ‘automatic updates’ feature for ‘minor’ releases was introduced in WordPress 3.7 version. This allowed WordPress to automatically install new minor and security releases to improve your website security.
However, starting WordPress 5.6, by default, every WordPress site has ‘automatic updates’ enabled for both minor and major releases. This meant, that if you install any version starting WordPress 5.6 onwards (i.e., 5.6, 5.7, 5.8, etc.), your WordPress instance would automatically get updated to the latest available WordPress version at the time.
4. How To Install Older WordPress Version
In order to install any older (>v5.6 but not latest) version of the WordPress, you would need to stop the ‘automatic update’ feature even before the WordPress installation begins else as soon as you finish the installation, the WordPress would automatically get updated to the latest version available at the time, without notifying you. Here are the steps you should take to install an earlier version of WordPress other than the latest.
5. Launch XAMPP and Start Servers
NOTE : For this article, we are assuming that you already have a working XAMPP installation on your localhost. If you don’t have XAMPP installation on your system, please refer to this article about How To Install XAMPP on Windows and complete the XAMPP installation before following the below steps.
5.1. Start Apache and MySQL Servers
Launch the XAMPP Control Panel as ‘Administrator’ and start the Apache Server as well as MySQL Server. You can do that by clicking on “Start” next to the modules.
6. Creating Database using XAMPP
Next, let us start by creating a database for WordPress using PHPMyAdmin.
6.1. Launch PHPMyAdmin
Open a new browser tab and type the following URL to launch PHPMyAdmin, http://localhost/phpmyadmin/ . This should launch the following web interface
6.2. Create Database for your WordPress
Navigate to the Databases tab at the top of the page of phpMyAdmin. Provide a name for your new database. In my case here, I am creating a database with the name ‘mywebsite_db’. After you have filled in your database name, click on the ‘Create’ button to continue.
This step concludes your database creation for the WordPress website. Now let us move on to install and configure the WordPress site.
7. Download and Set Up WordPress Folder
7.1. Download WordPress from Archives
Download an older WordPress version of your choice from the WordPress release archives page as shown.
7.2. Create project folder to host WordPress
Create your project folder inside XAMPP’s htdocs to host your WordPress files. Proceed with creating a new folder into XAMPP’s htdocs folder for your site and provide a name of your choice. For example, I am going to name it as ‘mywebsite’.
7.3. Extract WordPress files into folder
To install WordPress locally, you need to extract WordPress files (unzip) into the newly created folder inside ‘htdocs’, in our case we will copy it into ‘mywebsite’ folder which we created.
8. Edit WordPress Configuration File
As mentioned earlier, just before we start the WordPress installation, we should disable the ‘automatic-update’ feature of WordPress so that it does not automatically upgrade our chosen version.
If we skip this step, then WordPress would automatically upgrade itself to the latest version available at the time (provided it has access to the internet) soon after the installation completes.
8.1. Make a Copy of Sample Config File
Navigate to the WordPress project folder and locate the sample configuration file with the name ‘wp-config-sample.php’.
Make a copy of the ‘wp-config-sample.php’ in the same folder and name it as ‘wp-config.php’. This will be our WordPress configuration file which we will edit in the next step.
8.2. Input database details into config file
Open the WordPress configuration file you created in the earlier step, for editing. Fill in the values for the following parameters as per your database environment credentials.
- DB_NAME [your database name]
- DB_USER [fill in user as ‘root’]
- DB_PASSWORD [no password, leave blank]
- DB_HOST [fill in ‘localhost’]
Leave all other parameters in the configuration file to default as-is. Save the file and move to the next step.
8.3. Disable ‘auto-update’ WordPress feature
As discussed earlier, since we want to install an earlier version of WordPress (not the latest), hence we need to disable the ‘automatic-update’ feature of WordPress. You can do this by adding the following parameter in your ‘wp-config.php’ file.
/** Disable Development, Minor, and Major updates */
define( 'WP_AUTO_UPDATE_CORE', 'false' );
Since WP_AUTO_UPDATE_CORE can be defined with one of three values, each producing a different behavior:
- Value of
true
– Development, minor, and major updates are all enabled - Value of
false
– Development, minor, and major updates are all disabled - Value of
'minor'
– Minor updates are enabled, development and major updates are disabled
Hence, rather than disabling all kinds of updates, a better option is to at least enable minor and security auto-updates. We can do so using the following:
/** Enables Automatic Minor Updates Only */
define( 'WP_AUTO_UPDATE_CORE', 'minor' );
So let us add the above parameter and values in our ‘wp-config.php’ file. You can add these lines towards the end of your configuration file as shown in the screenshot.
9. Start WordPress Installation
Since we have now set up our database as well as the WordPress config (wp-config.php), we are all set to start the WordPress installation.
9.1. Start WordPress install process
Launch your web browser and enter the following URL in your browser –
http://localhost/[Name of Your project folder created inside htdocs]In my case, this is – http://localhost/mywebsite/
This will load the WordPress installation wizard and you’ll be asked to provide your website and website admin details. Fill in the required details and click on the ‘Install WordPress’ button.
Once the installation is complete, you should see the following screen.
9.2. Log on to WordPress Dashboard & Verify
Next, enter your credentials and login to your WordPress site dashboard.
Finally, you’ll reach your admin dashboard. It looks like this. Now verify the WordPress version. It should be the same version that you started with.
NOTE : Since we have disabled automatic updates for ‘major’ WordPress versions. Hence bear in mind that you will have to ‘manually’ update your WordPress ‘major’ version