The post I’ve written yesterday about giving WordPress its own directory during installation, just so happened to be WordPress upgrade day. I was rather surprise at yet another upgrade because it was not too long ago that there was this emergency upgrade to address the issue where someone hacked into their distribution server and added malicious code in the WordPress 2.1.1 package. Oh great, here we go again. I thought what the hack, I could write a post about the upgrade and how easy it is now that files are kept more separated from the WordPress files. So, today is the first real test with this kind of layout.
NOTE: If you intend to follow the instruction below for the upgrade, please read and understand the official upgrade guide at WordPress.org before you proceed. There are no guaranties that the fine folks at WordPress will not throw in a curve ball from time to time. At the very least scan through the guide to see if there is anything different with the version you are going to use for the upgrade. You have been warned.
Here are the simple steps I’ve taken to upgrade WordPress from version 2.1.2 to 2.1.3. You are expected to know your way around the Linux/UNIX prompt or the cpanel equivalent to be able to follow the guide or (God forbid) the Windows system.
- Backup the whole website starting from the root directory of your website. Make sure to include every file (we all screw up from time to time, so better be safe than sorry).
- Backup your database. Usually during the upgrade, there will be a step to upgrade your database. Always backup the database when ever you do anything that touches the database. Besides, it does not hurt to have an extra pair of backup.
- Login to WordPress Dashboard and deactivate all the plugins.
- At the root of your website, rename your wordpress directory to something like “myblog.bak”. Does not matter as long as you remember what it is and it does not already exist and must not be “wordpress”.
- Download and unzip the WordPress package. There should now be a directory name “wordpress” in the root directory of your website. If that is not the name you use before, move the “wordpress” directory to the name you have use the last time. For example “myblog”
- If you have followed the installation instruction in yesterdays post, you should only have custom files in the wp-content directory. Now, move over all your custom files to the new WordPress directory. Remember not to overwrite the new WordPress files. If you have customized some of the WordPress files, you will need to figure what are the changes you have made and port it over to the new files.
- You should be all set now to upgrade the database. Just follow the rest of the instruction from the official guide and you are set.
- When you done with the upgrade, and verify that everything is in order, remember to cleanup the old WordPress directory at step 5.
The experience in this upgrade is a much pleasant one for me. In the past, I will have to sort over all the files and see if they belong to WordPress or not and make sure I pull over all the customization. One thing to note is that if you do not customize any files that belong to the WordPress package, the upgrade will be the most trouble free. For example, if you want to customize and use the default WordPress theme, make sure you copy the whole directory and customize the copy. Trust me, it will make your life much easier.