WordPress Reverse Upgrade Guide

Millions of bloggers and other webmasters build their websites using WordPress, probably the world's most popular open source software for publishing web content. Setting up a website with WordPress is very easy, and there are thousands of free WordPress Themes to choose from to create a professional look 'out of the box'. So far, so good, but…

Every few months (or sometimes weeks) the WordPress development team brings out a new version of the software. Previous versions are no longer supported, so websites built with WordPress need regular upgrades to the latest version.

As well as adding new features and improving performance, new versions also fix any security issues that may become evident in the previous version. So it's a good idea always to upgrade to the latest version. The WordPress documentation provides excellent and detailed instructions on how to perform an upgrade and in most cases it can be done without any problem. But if something goes wrong it's important to be able to restore your previous version of WordPress while you investigate the problem behind the scenes. This article describes a step by step method of upgrading WordPress by which the restoration of a previous version can be done as easily and quickly as possible.

Step 1: backup the database and files

(1) Backup the WordPress database. Instructions on how to do this are provided here and here.

(2) Backup the WordPress files. Use an FTP client program to download all the website's WordPress files from the server onto your hard drive, maintaining the folder names and structure.

Step 2: create a new database

(1) Create a new MySQL database on the same MySQL server and import the WordPress backup. If the data is larger than 2 megabytes it may be neccessary to use a 'staggered MySQL dump importer' such as BigDump.

(2) Test the new database by editing, as required, DB_NAME, DB_USER, DB_PASSWORD, and DB_HOST in wp-config.php and uploading it to replace the existing file. The WordPress website should be exactly as it was before. If it isn't, something went wrong with either the database backup or import, or both, and needs to be fixed before proceeding.

(3) Un-edit wp-config.php to what it was before and upload it to replace the one you just edited to test the new database. Everything should now be as it was before you began.

Step 3: get the latest version of WordPress

(1) Download it from WordPress.

(2) Unzip the files. The WordPress package will be unzipped into a folder called wordpress. Backup this folder with a new name so that you have a perfect copy of the original download.

Step 4: upload most of the new version

(1) Read the detailed instructions to see which files are affected.

(2) On the server, alongside the existing WordPress folders, create new ones named wp-admin-N and wp-includes-N. The N is for 'new'.

(3) Don't delete anything, but upload the required files (from the new version wp-admin and wp-includes folders) into each of those new folders on the server. Nothing you've done so far should have affected the website.

(4) De-activate all WordPress plugins.

Step 5: temporarily close for maintenance

(1) Create a simple HTML file that contains text saying something like "This website is temporarily closed for maintenance. Please check back in 60 minutes.". Save the file somewhere as index.php. The file will shut down your WordPress pages during the upgrade and prevent visitors to the website from seeing 'work in progress'.

(2) Upload the file to your WordPress website root folder to replace the WordPress index.php. Then visit the website to check that this file is displayed.

Step 6: switch to the new files

(1) On the server, rename the wp-admin and wp-includes folders to wp-admin-P and wp-includes-P. The P is for 'previous'.

(2) Now rename the wp-admin-N and wp-includes-N folders to wp-admin and wp-includes. These folders, now correctly named for WordPress, are the ones that contain the upgrade files.

(3) Delete the existing wp- WordPress files in the root folder (except for wp-config.php and upload the new versions, letting the 'closed for maintenance' index file be replaced with the new WordPress version.

Step 7: do the upgrade

(1) Navigate to http://www.yourwebsite.com/wp-admin/upgrade.php and follow the instructions, if any.

(2) Check the website to make sure the upgrade ran successfully. If it didn't, then (i) reverse the previous renaming of the wp-admin and wp-includes folders, (ii) reinstate the previous WordPress root folder files from backup, and (iii), as in Step 2 (2) above, edit wp-config.php to the settings for the new database. Everything should now be back as it was before the upgrade, except that the website is now using the new database (which contains the original version of all the data).

(3) If the upgrade was successful, complete whatever else it says in the detailed instructions.

(4) Re-activate all WordPress plugins.

Recap on reversing a WordPress upgrade

The point of this procedure is to allow a faulty upgrade of WordPress to be reversed as quickly as possible (about one minute). The reasons for a faulty upgrade should still be investigated, corrected, and the upgrade performed again until it's successful.

Post a comment


About adding a Smiley Smiley »

Image Galleries
Beach Huts, Port Phillip Bay, Australia Seascapes, Port Phillip Bay, Australia
Recent Comments