Moving and Upgrading your WordPress

Posted on June 23, 2009

Note: This post assumes you are using the self-installed WordPress on a Linux-based server running MySQL and phpMyAdmin. It also assumes that all your current plugins and your current theme is compatible with the latest version of WordPress.

Please read through all of these instructions and make sure you know what they mean before you begin. Backing up your site and database before any transfer is always a wise move.

Step 1: Download your Database

Log into your database through phpMyAdmin and go to the Export tab. Use these values for your export:

  • Export ALL TABLES in SQL format.
  • Check STRUCTURE, and then "Add IF NOT EXISTS", "Add AUTO_INCREMENT value", and "Enclose table and field names with backquotes".
  • Check DATA and then "Complete inserts", "Extended inserts", "Use hexadecimal for BLOB", and "Export type INSERT".
  • Check SAVE AS FILE and save to your hard drive.

Step 2: Download your Current Site

FTP to your current site and download the following items:

  • The folder WP-CONTENT.
  • The file WP-CONFIG.PHP.
  • Any files or folders you may have added outside the WordPress structure, like a CSS or IMAGES directory.

Step 3: Upload your New WordPress

For a general discussion of installing WordPress, see the 5-minute Installation Guide at WordPress.org. For this, you will be doing things a bit differently because you are transferring a blog, not just installing a new one.

  1. Download the latest version of WordPress. Unpack the files and upload everything but the WP-CONFIG-SAMPLE.PHP file to your new server.
  2. Upload your old custom theme (in the WP-CONTENT folder you downloaded earlier) and any images/css/etc you may have had outside the WordPress folder structure at your old site.
  3. Open the new WP-CONFIG-SAMPLE.PHP file and your old WP-CONFIG.PHP file. You will be modifying the WP-CONFIG-SAMPLE.PHP file. Follow the instructions in the file to get your Secret API Key. Then use the information in your old WP-CONFIG.PHP for the database and username, and get the hostname from your new host. Save this WP-CONFIG-SAMPLE.PHP file on your hard drive, rename it to WP-CONFIG.PHP and upload it to your new server at the root file level. (See below for additional notes on the WP-CONFIG.PHP file and changes you may have to make to it.)
  4. Hold off on uploading your existing plugins until you are sure your upgrade installation is working.

Step 4: Set Up your New Database

Log into the phMyAdmin on your new host, click on the Import tab, and Import the SQL file you downloaded in step 1. If for some reason you can’t use the original database and/or username, make sure you put the new database and/or username in your WP-CONFIG.PHP file on your new server. If you have changed your base URL, see the special instructions below before proceeding on to step 5.

Step 5: Install and Upgrade your Database

Go to the install URL on your new site, http://example.com/wp-admin/install.php for example, and follow the instructions to install WordPress and upgrade the database (if needed/prompted to do so).

Step 6: Add Plugins

If you had plugins originally installed, and your site is now working, you can upload the plugins in your original WP-CONTENT/PLUGINS folder back to the new site. Once they are uploaded, the WP-ADMIN will tell you if there are updates available for these plugins before you enable them.

Special Step: If You Changed the URL

If you have changed the site URL, or you’ve gone from a temporary URL (such as http://hostname.com/~your_account/) to your permanent URL (http://www.your_domain.com), you will need to follow this additional instruction between steps 4 and 5 above:

  1. Log in to phpMyAdmin and click on the SQL tab.
  2. Enter the following code into the SQL window

    UPDATE wp_options SET option_value = ‘http://new-url.com’ WHERE option_name = ‘home’;
    UPDATE wp_options SET option_value = ‘http://new-url.com’ WHERE option_name = ’siteurl’;
    UPDATE wp_posts SET guid = replace(guid, ‘http://old-url.com’,'http://new-url.com’);
    UPDATE wp_posts SET post_content = replace(post_content, ‘http://old-url.com’, ‘http://new-url.com’);

    replacing "http://new-url.com" with your new URL, "http://old-url.com" with your old URL, and wp_ (as in wp_posts, wp_options) with your table prefix. (The default on WordPress is wp_ but you may have changed it on your previous installation. If your default is not wp_ in your tables, you’ll also make sure this table prefix is reflected in your new WP-CONFIG.PHP file and re-upload before proceeding to step 5.)

And there you have it! If you need additional assistance or your custom theme needs to be updated to work with the newest version of WordPress, consider hiring That PHP Girl!

Tags: , , , , , , , ,

2 Responses to “Moving and Upgrading your WordPress”

  1. [...] you used parts of my post on Moving and Upgrading your WordPress to change your blog’s URL (if say, for example, you were trying to take a development site [...]


  2. Yuri
    Apr 23, 2010


Leave a Reply


Kudos

  • Working with Nikole has been a great asset to my business. Nikole is an extremely bright, creative and detail oriented professional who has a ton of programming and internet marketing knowledge. She has helped me deliver a variety of web development projects from simple WordPress website customizations to complex ecommerce solutions. Nikole requires very little direction and provides excellent service. I would recommend Nikole’s services to anyone looking for a can-do PHP programmer.

    - Michelle Carroll, Owner, 1Stop Marketing Solutions

Categories