Recently, a new client of ours came to us with 2 MAJOR problems; 1) The version of their website’s WordPress Content Management System (CMS) was EXTREMELY outdated at version 3.1 and 2) Their site had been infected by a virus that caused defacement of certain pages within the site. Needless to say, we went straight to work on fixing both of these issues and were able to successfully remedy the virus issue (we’ll cover that topic in a later post) as well as upgrade the entire site from WordPress 3.1 to WordPress 3.9.1 (the current version of WordPress as of this blog post writing). The techniques we used in upgrading the website will be the focus of this blog post
Before we get too deep into the details of how we successfully upgraded the site, it warrants us to state the following:
The entire scenario we are speaking of here is for a SELF-HOSTED WordPress installation on a standard Linux/Apache/MySQL/PHP (LAMP) hosted server. This is NOT meant to be instructions for a WordPress.com hosted site or a Multi-Instance WordPress installation
We tried unsuccessfully to upgrade the WordPress 3.1 in place to WordPress 3.9.1 however, there was just no direct upgrade path that worked well (without breaking major portions of the site)
Be sure to BACKUP both the current website file structure AND MySQL database. These 2 components together make up the ENTIRE website and should be protected with the utmost care in case of having to reverse the upgrade procedure for any reason
OK… now let’s talk about the steps required to upgrade
1. Install a FRESH, NEW version of WordPress (3.9.1 as of this writing) – This will require you having either another hosted server (other than the current production site) OR you can install the new instance of WordPress in a sub-folder (i.e. /new) under the current production site. So long as you can create a 2nd WordPress database (other than the current production one) in your MySQL database. Since we had access to a different server, that is the path we chose.
2. Log into the WordPress Admin Dashboard of the NEW WordPress site – This will allow you to perform a few housekeeping items like deleting unused themes like TwentyFourteen & TwentyThirteen (I personally only keep one extra theme in case of troubleshooting and I prefer the good ‘ole standard of TwentyTwelve), removing or changing the “Uncategorized” post category, removing irrelevant plugins, & sample posts/pages.
3. Upload and Activate the old theme from WordPress 3.1 – This primarily involves ftp’ing the /wp-content/themes/<old theme name> from the existing website into the same folder under the new WordPress 3.9.1 website. Now in the WP admin dashboard go ahead and activate the theme. Note that since we have not yet transferred the content folder, some images might still be missing from looking at the new site from the front-end. You should now have the older theme activated along-side your backup TwentyTwelve theme (see Image 1 below)
4. Upload and Activate the plugins from WordPress 3.1 – If you view the default plugins that have been installed in your new WordPress 3.9.1 site, it will look like the following (see Image 2 on the right).
As a side note, you can COMPLETELY delete and remove the Hello Dolly plugin… not much needed there. To complete this step (much like the previous one), FTP the entire /wp-content/plugins folder from the existing WordPress 3.1 website into the same folder for the new site. Once that is done, refresh your plugins screen of the WP admin dashboard and it will look something like this (see Image 3 below)
5. The next step is to go through EACH PLUGIN INDIVIDUALLY and activate them. This process will write the required database entries for each plugin into your new WordPress 3.9.1 database. Be sure to do each one separately so you can monitor any issues that might arise and require a completely new install of the plugin. Once you have completed activating each one, your Plugins page should show that all are active and some may need updating (see Image 4 below). If so, then go ahead and update each plugin.
6. Set the Homepage and Blog Page – This is accomplished by clicking on Settings – Reading in the WP admin dashboard. Refer back to the way it is set in the older WordPress 3.1 site if need be.
7. Export all Posts and Pages from the old site – Login to the WP admin dashboard of the old WordPress 3.1 and click on Tools – Export. Now click the All Content option and then click the Download Export File button. (see image 5 below). This will save the contents of both Posts and Pages into an XML file.
8. Import the Posts and Pages into the new site – Now go over to the WP admin dashboard of the new site and click Tools – Import and click the WordPress option at the bottom of the list (see image 6 below).
Since this is the first time you’ve used the import functionality in the new site, you will be prompted to install the WordPress Importer plugin. Proceed with that install by clicking the Install Now button (see image 7 below). Finally, click the Activate Plugin and Run Importer button
9. Once the importer plugin is installed, you will then need to select the XML file you created in step 6 above. Click the Choose File button and locate the .xml file on your computer then click the Upload file and import button (see image 8 below)>>see the import screen.
10. The first step is to select (or create) the author you wish to assign to each of the newly imported posts. Make your selection here and then check the box to Download and import file attachments. While you may not have any file attachments associated to posts, this is a good option to ensure that any miscellaneous content gets imported as well. Finally click the Submit button (see image 9 below).
11. Transfer the Uploads folder from the old site to the new site – This next step will ensure that ALL files, documents, images, etc. that were present in the old site are also available in the new site. FTP the entire contents of the /wp-content/uploads folder from the old site into the same folder path of the new site.
12. Manually recreate the site menu – In order to get your Menu functionality working again, you will need to click on Appearance – Menus in the new WP admin dashboard. We find it best if you have 2 browser windows (or 2 browser tabs) open at the same time to accomplish this. One is opened to the Menu page of the old site and one is open to the Menu page of the new site. This makes rebuilding each menu option easier. In our particular case, we only had 5 main menu items so it was quite easy and quick.
13. Manually recreate any widgets – Again, depending on how complex your site is this could go really quickly or could take a while. While having your 2 windows (or tabs) open to the different WP admin dashboards of each site (old and new), you will be able to go into Appearance – Widgets and begin building each of the required widgets and associated them to their specific area within the site template.
14. Don’t forget to set the Permalinks! – This step can be easily overlooked, but you will want to click on Settings – Permalinks and ensure that the permalink setting for the new site is identical to how it is in the old site.
CONGRATULATIONS! You have successfully upgraded your WordPress 3.1 site to the most current version of WordPress!
If you ran into ANY issues along the way, please contact us and let us know… we can certainly try and help you out!