Home > FAQ & Tip > Upgrade WordPress using Export and Import tool

Upgrade WordPress using Export and Import tool

December 29th, 2008 Leave a comment Go to comments

After looking through forums, I saw a lot of people (including myself) experienced a bad time with wordpress upgrade where thing doesn’t always happen in the way you expected to happen, either the whole thing get screwed up or not 100% working in the way it should be. The worst thing is they could not revert back the old working version.

If you have similar problem above, maybe this post is a great tip for you. This will also be a good post for my future reference. I have used this method when I upgrading this website (computer-faqs.com).

Table of Content

  • Before upgrade
  • Upgrade
    • Export
    • Install
    • Import
  • After upgrade
  • Prepare to go live
  • Simple Rollback
  • Summary

Before upgrade

  • Learn a little bit about new version. Read release note of the new version (eg wp 2.7 new features) so you know what’s new and what to expect after upgarde.
  • Plan, plan, plan
    • When to do it? work out the best time to bring your site down for a 10-20 min
    • How to do it? whichever method you use, it’s your choice
    • Is Roll-back strategy secured? (a MUST). If things ever go wrong be sure you can revert it back
    • Who will do it? do it yourself or get help if required
  • Understand Requirements, if you chose to follow this instruction, it will require a new sub-domain created, please check first if you are able to do so.
  • Now, relax yourself, have a god mood, be ready to rock-n-roll and do not panic if thing goes wrong because this tutorial will not mess your existing version at all.

Upgrade

Instead of following a classic way of upgrading, we are going to adapt a whole new way and worries-less about what said in this instruction. Just stay focused on a new version is all you need to do. Let me emphasise, this is not exactly an upgrade and polish the old chair but bring your existing wordpress content to a completely new comfortable chair.

  1. Export
    Export existing content from old/current wordpress version

    • Login to your current wordpress Admin
    • Go to Manage > Export
    • Under Options/Restrict Author, select “All Author
      Screenshot - Upgrade-wp-01
    • Click Download Export File
    • You should be prompted to save file (eg. wordpress.2008-12-28.xml)
    • Open your FTP program and connect to your hosting server
      • download wp-confi.php to your local disk and rename it to wp-config-old.php
      • download .htaccess file (if you have one) to your local disk and rename it to .htaccess-old
    • Now make sure it’s still running fine, so you can rollback if required.
  2. Install
    Install a new wordpress (we use version 2.7 for this demo)

    • Connect to your server
    • Create a new folder mysite-new
    • Login to your Domain Admin Panel and create new sub-domain pointing to above folder. For example new.mysite.com pointing to mysite-new

      Note: The folder you created above will be renamed to mysite (same as your current domain) after you have completed the upgrade. So you are free to call it anything you like.

    • Extract contents of WordPress 2.7
    • Copy file wp-config-sample.php to wp-config.php
    • Open wp-config.php with text editor
    • Scroll to MySQL settings section and fill in the configuration the same as in wp-config-old.php you downloaded in step 1
      /** The name of the database for WordPress */
      define('DB_NAME', 'putyourdbnamehere');
       
      /** MySQL database username */
      define('DB_USER', 'usernamehere');
       
      /** MySQL database password */
      define('DB_PASSWORD', 'yourpasswordhere');
       
      /** MySQL hostname */
      define('DB_HOST', 'localhost');
       
      /** Database Charset to use in creating database tables. */
      define('DB_CHARSET', 'utf8');
       
      /** The Database Collate type. Don't change this if in doubt. */
      define('DB_COLLATE', '');
    • Make changes to Authentication Unique Keys section as per instruction in the file
    • Scroll to WordPress Database Table prefix section and change this line
      $table_prefix  = 'wp_';

      to

      $table_prefix  = 'wp27_';

      Note: Needless to create a new database. We are using the different tables set in the same database. Make sure value you set for table_prefix is not the same as your existing one or you are in big trouble.

    • Upload all files to mysite-new folder
    • Now run the installation with wordpress Famous 5-Minute Install instruction
    • Go to new WordPress Admin and delete default post and default comment, so it is cleaned and cleared.
  3. Import
    Import contents from old wordpress to new

    • In new WordPress Admin. Expand Tools > Click on Import
      Screenshot - upgrade-wp-02
    • Click on WordPress (Import posts, pages, comments, custom fields, categories, and tags from a WordPress export file)
    • In Import WordPress click on Browse button
    • Select your exported file in in step 1 (eg. wordpress.2008-12-28.xml)
    • Follow instructions on screen and select options that suits your requirements.

After upgrade

Now you have a new version of wordpress which is running concurrently with your old one but different web address. However both version containing the same content.

A new more steps below will be tuning your new wordpress to work the same way as your old one.

Note: You can run both version of your sites at the same time for comparison purposes

  • Configure general settings to be the same as the old version
  • Configure Theme
    If you want to have your website look the same as the old one, just upload the same theme (make sure it’s compatible with the new version of wordpress
  • Configure Plugins
    WordPress 2.7 include an easier way to install plug-in where you can search and install on the fly, without having to download to your local disk first. Install those Plugins you had in the old version and enable them
  • Test and Compare the 2 version of your website until you are happy with the new one

Finally prepare to go live

  • Login to new.mysite.com Admin
  • Change Blog address (URL) back to your original url eg: http://www.mysite.com
  • Click Save Changes, then ignore what appear on the screen for now
  • Close your Web Browser
  • FTP to your hosting server
  • Rename you old wordpress folder from mysite to mysite-old
  • Rename your new wordpress folder from mysite-new to mysite
  • Go to your existing domain url, eg. www.mysite.com, you should now see the new version of your wordpress
  • Now Login to Admin
  • Go to Settings > Miscellaneous Settings
  • Check  Store uploads in this folder and change the value to correct path, otherwise you will have problem when you try to upload file latter.

Simple Rollback

In any case if you require to rollback to your original site version, follow these steps

  • FTP to your hosting server
  • Rename folder mysite to mysite-new
  • Rename folder mysite-old to mysite
  • Check  Store uploads in this folder and change the value to correct path, otherwise you will have problem when you try to upload file latter.
  • Finished!

Summary

We are upgrading wordpress in a whole new way with worries-less and really simple to rollback. We are doing Export/Import instead of classic way of upgrading that comes with a lot worries and concerns.

If you find any part of this post faulty, mistakes or needs improvement please post your comment below, I will action it accordingly.

Please note that, this post is for references and additional helps only. You should read and understand it if it can be use for your requirement. Also refer to CC License on the sidebar before you use it.

Categories: FAQ & Tip
  1. No comments yet.
  1. No trackbacks yet.