Many bloggers are upgrading versions in WordPress at the moment to 2.7 – so when Hendry Lee offered to write this guide to doing it I thought it’d be useful to many. Enjoy.
WordPress 2.7 codename “Coltrane” has been released earlier in December 2008, with the most significant change being the new Dashboard interface. A lot of people upgrade immediately, but a few others are still hesitant for one reason or another, as seen in the various blogging forums, including the WordPress Support Forums.
The rule of thumb is simple. You should upgrade as soon as time permits.
Not only because this version includes a bunch of new features and security updates, but also the fact that new versions will make future upgrades easier and painless with auto-upgrade and compatibility with newer versions of PHP and MySQL.
However, many people haven’t yet taken the time to upgrade because of a few concerns:
- Compatibility with installed theme and plugins. Most themes work out of the box with WordPress 2.7, with a few exception for themes that include custom queries to sticky posts and a few minor and easy-to-fix issue. (Well, if you are a theme developer who have access to a friend who are in the know, that would be quick to fix.)
- Lack of technical ability to upgrade. WordPress Codex includes a standard 3-step and extended upgrading processes. Even easier if your hosting includes cPanel, an upgrade is available through Fantastico — assuming that you install the previous version through it and your host has installed a new version of Fantastico.
- WordPress upgrades happen too often. Due to security issues and others, sometimes it is necessary to revise and update the code. If you resist upgrading to 2.7 because of this reason, there is a good news. This is perhaps the last upgrade you must do manually. The auto-upgrade feature makes the process easier after 2.7.
If you are more convenient with minor upgrade, you should at least make sure that you are running version 2.6.5 because it provides security updates for the latest release of WordPress.
However, it is important to remember that future upgrades will be harder if you are behind a few major releases. The development resources are now focusing on the 2.7 branch and future release (2.8), so if you want to enjoy new releases and features, upgrade is necessary.
How to Upgrade to WordPress 2.7 Directly
Upgrading a major release is better done through a step-by-step process. With a minor release, you can go from 2.6.2 to 2.6.5 without a problem, but with a major upgrade it is not recommended to go straight from 2.7 from 2.3, for example.
Most people upgraded from 2.6.x to WordPress 2.7 without a problem, but just to be on the safe side, you should check to make sure that your web hosting provider is compatible. As you notice, most popular hosting providers have already supported the new release.
Although it is worth mentioning that WordPress 2.7 still supports PHP4 at the moment, it may discontinue that at some point, mostly because PHP4 is no longer being updated.
Finally, once you are ready, follow the steps in the WordPress Codex, either in the standard or extended upgrade page to proceed. The latter is preferable if you have used plugins beyond the ones that come with WordPress installation.
What If You’re Still Unsure
For bloggers and web publishers who use WordPress in busy sites, it is understandable when they hesitate to perform an upgrade because just a minor glitch usually means frustrating their users and losing revenue.
Certainly this is not desirable.
For people who customize WordPress heavily, the thought of losing all the hard work or have to do it all over again certainly hold them back.
If you can relate to one of the above situations, there are still ways you can upgrade confidently. The answer lies is testing.
While it involves more work, it also gives you peace of mind during the whole upgrade process. Remember as said earlier, this may be the last time you have to go through this process manually.
After you’ve gone through the whole thing, you may realize that even with the manual process, it is not as hard as you might imagine.
If nothing else, these upgrades allow you to create a testing platform for experimenting. If you are a theme developer or tester, or if you are developing WordPress plugins, you will be able to test them with a production-like environment with real data, complete plugins and your own theme.
Finally, in the worst case, you have to migrate your plugins or existing theme to make them compatible with WordPress 2.7 or disable the plugins until upgraded versions are available. But of course, you can choose to not upgrade if you want to make sure everything runs smoothly in 2.7 before you upgrade.
You can even speed up the process plugin migration process — but avoid pushing as the authors may do this for free — by encouraging the plugin developers to update their plugins. If enough people want the support, most likely it will happen, unless the developers don’t plan to continue the development again, for which you should start seeking an alternative or even take over the project.
Migrating to WordPress 2.7 Safely — The Plan
So, what’s the alternative plan(s) I am talking about?
It is a safe way to migrate your WordPress installation by making sure all of your plugins and installed theme work.
This method involves installing a separate copy of WordPress 2.7 in a test environment, load all the plugins and theme, including your blog posts and comments into it. Before you actually decide that the new version of WordPress works flawlessly for your site, you attempt your best to break it.
After all, it is better to find out if something breaks first during testing rather than having your visitors fall into it unintentionally.
Once you are happy with it, make the transition quickly. It is possible to do it without any down time at all. Well, perhaps a few seconds at most.
If that sounds too techie, perhaps you are true. I can’t change your perception but practically it is not hard at all. As long as you follow the steps below carefully, and you execute the plan only after you understand the whole process, you’d be surprised that you could do that too.
With a bit of background prepared, now it’s time for the exciting part.
1. Create a Copy of Your WordPress Installation
The good thing about open source software is that it is free. You can create a new WordPress blog in a few minutes, whenever and wherever you want it, with one of these scenarios:
- Install WordPress 2.7 in a directory under your existing blog. If your blog is hosted under example.com, it is possible to create another directory such as example.com/wp27 and make it as if it is another copy of example.com.
- Install WordPress 2.7 in a new domain. Just like the above scenario, but you can replicate the whole structure, even the directory under the domain, to match the main blog. Of course, the only difference in this backup blog is the domain name.
- Install WordPress 2.7 locally. There are a few ways to do this, either install it as a service running under your desktop operating system (Windows) using Apache or various alternative and lightweight web servers like nginx or lighttpd.
I’ve created an experimental WordPress virtual appliance called WP-Sandbox. It allows you to run a web server on a virtual machine quickly, using VMware Player. It is still in a very early stage of development. Currently, as of this writing, I have already spotted a few bugs so expect an upgrade soon.
Important: Rather than pointing the backup WordPress 2.7 installation to use existing database, you should backup your database and import it to a newly created database. If you have limited number of allowed database in your web hosting account, either install it locally or modify it to install in the same database but with a different prefix.
This upgrade of WordPress requires you to upgrade the database. By pointing it to a new / backup database, you avoid modifying the production data.
Don’t worry if you don’t understand what I’m talking about above. Just pick one that fits you well and go with it.
Once you have the WordPress 2.7 code ready in the new location — including the edited configuration file (wp-config.php), export your existing data and import / restore it to the new database, you are ready for the next step.
I almost forget. Add the following lines to wp-config.php:
define('WP_HOME', 'http://example.com/wp27'); define('WP_SITEURL', 'http://example.com/wp27');
This saves you from modifying the database options.
2. Copy All Plugins and Active Theme
In this step, you are going to prepare the new WordPress 2.7 installation to resemble your existing blog as close as possible, but the most important things are plugins and theme. Copy the whole wp-content/plugins directory and your activated theme in wp-content/themes to the new WordPress directories, except that you don’t want to overwrite akismet and hello.php (the latter is just an example WordPress plugin showing random line of lyric from the song Hello, Dolly).
WordPress centralizes content in the wp-content directory. Unless you change the uploaded media to another place, it should be in wp-content/uploads. Duplicate the whole directory and sub-directories to your new WordPress if you can afford the disk space.
At this stage, you’ve already created an exact same copy of your WordPress blog, except that the backup blog is run under the shiny new version 2.7.
Unless you have other directories or files hosted under the domain in other directories, you are done with this step. It is recommended that you copy those complete directory structures over to the new blog. In the process, make sure you don’t overwrite any new WordPress core files.
You may also use your web hosting control panel to perform the duplication. FTP (or SFTP – secure ftp) is also common if you want to transfer files from remote (server) to local and vice versa. If you know basic Linux command line, you should be able to duplicate your data very quickly.
Note: Don’t forget the .htaccess, robots.txt, sitemap.xml, favicon.ico and other files as well.
3. Test, test and test
Now that you’ve created a complete backup of your blog in WordPress 2.7, now is the time to break it. I mean, do what you can to explore your blog just like a visitor would do. Pay attention to details and see if something breaks in 2.7 but not in the previous version of WordPress.
Ask a friend or colleague to test it for you, as others will often spot things that you fail to notice.
If you install various plug-ins that inject codes into your themes but are not visible on the screen, such as the meta keyword and description tags plugin, check to make sure they are all working properly.
Don’t rush through this process. Just because it looks well doesn’t mean there is no problem. Remember that at first most people didn’t want to upgrade because of the concern that it may not work for their blogs, so be a bit paranoid and test thoroughly.
4. Finalize installation on production server
After you’re satisfied with it, and most likely you will, you may want to do the upgrade process once again, but now targeting the production blog.
Here are some tips that let you minimize the down time. This method may not be suitable for everyone especially if your blog hosts a huge number of huge files but at the very least you can take some ideas and use them to make the migration process as smooth as possible.
- Extract or upload a copy of WordPress 2.7 to a new directory at the same level as the production blog. For instance, if your blog is at example.com/blog, extract a copy of WordPress 2.7 to example.com/wp27.
- Duplicate the whole data just like what you do in step 2 above. Use your favorite tool to do that, as long as it works for you. Most importantly, retain all the permissions of the files and directories so everything works after the migration process. Note that you don’t have to change the wp-config.php configuration variables like above because you want to upgrade your production database now. (You already have a backup copy of the database, right?)
- Double check if everything is already in place.
- Copy the directory of the production blog to something else, such as blog-2.6, and immediately after that, copy the wp27 directory to blog. If you are on Linux command line, you may do this on one line so it happens in a fraction of a second.
- Run the upgrade script, which is example.com/blog/wp-admin/upgrade.php, to continue with the above example. Follow the instructions on the screen and you are done.
Now perform extensive tests again on your production blog to make sure everything go smoothly.
If you have huge files that you don’t copy over from the old blog, now move them from the blog-2.6 directory to blog, which is now your WordPress 2.7 blog. WordPress 2.7 introduces a new contant NONCE_KEY in wp-config.php. For added security, you should complete all those keys if you haven’t. Replace the wp-config-sample.php to reflect your blog database and other parameters, and overwrite wp-config.php (backup first).
With the above method, notice that I didn’t take down the blog, put up maintenance message or use any plugin of that kind. Also if you have extra space to play with, this method is actually faster than replacing the WordPress files manually.
The second thing I want to bring up is that I didn’t deactivate any plugin at all. That process above works for me. If you want to ensure the process goes smoothly, follow the WordPress upgrade process (in the Codex, links above) to the letter and deactivate your plugins first before you upgrade. Note that you are responsible for your blog upgrade, even if you follow the steps above.
As of this writing, I just upgraded my blog at Blog Building University using this method. At the moment, I have 22 WordPress plugins installed on my blog. Not too many compared to others, but I’m impressed it works flawlessly.
The WordPress team is doing an awesome job there.
Enjoy your brand new WordPress 2.7!
(I remember a colleague from my last job seven years ago complained that I always leaved old files scattered. Perhaps he was right. You should clean up the old directory if you don’t need that anymore and delete the test database you’ve installed during the test.)
Hendry Lee helps bloggers overcome strategic and technological challenges in starting and growing their blogs. He is also an enthusiast about how to make money blogging and actively blogs in different niches. While you are there, download your free eBook and subscribe to the blogging e-course!
Follow Hendry on Twitter (@hendrylee).