Upgrading (our local install of) WordPress

In a previous guide, we walked through installing WordPress on a local machine. This time, we'll be upgrading WordPress. For this guide, we'll be upgrading from WordPress 2.0.1 to 2.0.2. Note that this guide will work equally well for upgrading to 2.0.3, 2.0.4 or 2.0.5.

Downloading WordPress

First, we'll have to download a copy of WordPress. Currently, the same download can be used to upgrade WordPress as to install WordPress, which makes things rather simple, in one sense. http://wordpress.org/download/

We'll download the zip file into our downloads directory (in my case, at c:\home\downloads\), making sure that we keep the 2.0.1 install file, at least until we can verify that this new version doesn't cause compatibility issues.

Backup our current installation

Now that we've downloaded the new version, we'll want to prepare our current version for the upgrade. When we do this, we'll be making backups of everything, so that we can roll-back to our working version, if necessary.

We'll first want to backup our current installation. This involves making a copy of the entire WordPress directory. In my case, c:\home\wordpress\.

Now, we'll login to phpMyAdmin to backup the WordPress database. Visit http://phpmyadmin.localhost/, and login using your wordpress user. If you've forgotten the password, you can find it by opening the wp-config.php file, in the main wordpress folder. Once you've logged in, click on the Databases link, in the main content area, under the MySQL column, and then on the wordpress database, on the following screen.

Once you do this, you'll see a listing of all of the tables in the wordpress database, along with size and the like. Click on the Export tab, to continue.

Here, you'll be able to export the tables that are a part of the wordpress database. First, use the Select All link under the Export column to select all of the database tables. In the Structure area of the SQL options column, check Add DROP TABLE. Scroll down, and check the Save as file item. Finally, hit the Go button.

Once you do this, you'll be prompted to do something with a file called wordpress.sql. We'll create a new folder in our c:\home\ folder called backups, and save this file to that folder. When you save the folder, add the current date before the extension. For example, wordpress_20060311.sql. This will ensure that you're able to keep multiple backups, and will be able to sort the files easily.

Now that we've made our backups, we'll need to disable any plugins that we may have running on our WordPress. Login to the wordpress, http://wordpress.localhost/wp-admin/, and hit the Plugins tab. If any plugins are activated, deactivate them.

Performing the upgrade

Now that we've made our backups, and disabled any plugins, we can proceed to upgrade the necessary files.

First, extract the downloaded zip file to it's own folder. Next, we'll be moving files from the new folder to our current install's folder. Because of this, it's a good idea to have two windows open while we're doing this. Depending upon the amount of customization you've done, you can either copy files over and overwrite them all (save a few mentioned below), or you can check the dates of each file, only moving over those files that have dates that do not match (between the new and old installs). Since you have backups, you can always get the older copy if necessary.

The files that you will not want to overwrite are;

  • wp-config.php file
  • wp-content folder
  • wp-images folder
  • wp-includes/languages/ folder
  • .htaccess files (which we haven't talked about before)

Working directory through directory ...

  • In the root folder, c:\home\wordpress\, the only file changed should be the wp-config.php file, and there won't be a matching one in the downloaded zip. So, move all files from the new zip into the old zip, overwriting all files.
  • In the entire wp-includes directory (including sub-folders), there's probably no reason to have modified any of these files. Move the entire wp-includes folder over, overwriting as necessary.
  • In the wp-content folder, delete the cache folder on our current install.
    • Next, move the index.php file over.
    • Now, move the plugins folder over. Since it's possible you installed plugins, we'll just want to overwrite the existing documents. If you have upgraded one of the standard plugins, however, you may want to verify after we have performed the WordPress upgrade that you did not lose this update.
    • The themes folder should contain the standard themes, which you can simply move over, as any modifications to the themes should have been done in a new theme, instead of in these.
  • Finally, move the wp-admin folder. Again, modifications probably weren't made to these files (by you), so you shouldn't lose any changes.

Now that we've upgraded the files, we'll just need to upgrade the database. Visit http://wordpress.localhost/wp-admin/upgrade.php, and hit the link that you're bound not to miss. You should see Step 1, which will tell you that you're done.

Now, visit http://wordpress.localhost/, login to the admin interface, and turn any plugins on, that you may have deactivated. All other options should be preserved.

Planning ahead for future upgrades

To make future installations easier, you can note which files you've made modifications to, when you make them, and keep a backup of both the original, and the modification. This allows you to easily determine which files you've changed.

You can also use a program like WinMerge, http://winmerge.sourceforge.net/, to then determine what changes were made between the versions.

View all of the steps to creating a local Web server, for development.