| |

Start afresh with WordPress

Jeffro raised a point of reformating your blog for WordPress 2.7. I’ve been blogging with WordPress since late 2003 and have been the blog software go through tonnes of upgrades. Over time, the use of tonnes of plugins and themes has caused my database to get extremely cluttered, so I decided to start afresh with WordPress 2.7, which was released today.

Note: Most users will not need to follow these steps. These are meant for advanced users. Normal users should follow the Upgrading WordPress instructions in the Codex. Proceed with extreme caution. You will not receive any support if you choose to follow the tutorial below. Remember to backup before upgrading.

Here are the steps I took in this process:

Step 1: Delete unnecessary junk before backing up

This is an optional but recommended step.

If you’re using Akismet, you should first delete all the spam comments to ensure that your exported file is not cluttered with junk.

Users of WP Super Cache would want to delete the cache as well before proceeding to the next step.

You could also clear out some useless tags and categories which you may not be using.

Step 2: Backup!

Follow the instructions at Backup your WordPress Database and Backing up your WordPress site available in the codex or our tutorial.

I also suggest downloading a copy of wp-config.php. We will use this to copy-paste the database settings.

If you are using cPanel, I suggest performing a Home Directory backup and a mySQL Database Backup. You can access the same under Backup after logging into your cPanel.

Step 3: Exporting WordPress

WordPress allows you to export all your WordPress content as a WXR file. WordPress eXtended RSS or WXR, will contain your posts, pages, comments, custom fields, categories, and tags.

To export this file navigate to Manage > Export and hit Download Export File. Save this file. We’ll be using this to import your posts after the upgrade.

If this file is greater than 8MB, then stop and read this. WordPress has a problem with WXR files greater than 8MB. You will need to split the file into multiple files in case you run into problems during the import process.

Step 4: Creating a Maintenance File

Create a simple html file that will be used to indicate that your blog is currently undergoing maintenance. This file will need to be called index.html so that your server will display this directly. Download a sample file.

Step 5: Deleting your WordPress installation

We will now delete our WordPress installation. This is of two stages. Deleting the database and deleting the files. You have two options w.r.t. deleting the database.

  1. Delete the database in cPanel / Plesk or your webhosting control panel and then create a database with the same name and link it again to the same user.
  2. Open phpMyAdmin and drop all the tables.

I chose to go with option 1.

For deleting the files, you will need to knock off the following files / directories. Either FTP into your installation and delete the following folders or delete the same using ssh.

  1. /wp-admin
  2. /wp-includes
  3. /wp-content/themes/classic
  4. /wp-content/themes/default
  5. /readme.html
  6. /license.txt
  7. All php files in the root directory

Do not delete the whole of the wp-content or the themes folders, just the classic and default subdirectories.

If you have a reseller account, a VPS or your own server, then you can even choose to delete the entire cPanel account and create a new one afresh. However, for the purpose of the tutorial we will stick to only deleting the database and files.

Step 6: Installing WordPress 2.7

Follow the Installing WordPress instructions for this. If you kept the database name and user same in step 5, then you can copy the database settings from the wp-config.php file we backed up in step 2.

Step 7: Importing WordPress

We will now import the WXR file we created in step 3.

Navigate to Tools > Import and select WordPress. Select the WXR file that you downloaded and hit Upload File and Import.

You’re WXR file needs to be 8MB or below. Some hosting installations restrict the upload to only 2MB. In this situation you may need to create a .htaccess or php.ini file in your root directory to take care of upload_max_filesize, post_max_size, memory_limit and max_execution_time.

You may need to split your WXR file into multiple files if its size is greater than 8MB and repeat this step till all the posts are imported.

Step 8: Installing Plugins and Themes

You now have a fresh installation of WordPress. Now, all you need to do is activate plugins that you want as well as the theme you wish to use. All settings will need to be reconfigured, but it’s worth the while!

Have you any tips regarding upgrading WordPress? Do comment below.

8 Comments

  1. One thing I recommend doing before you import your content is to turn off the option to send blogs a pingback or trackback url. As long as your permalink structure is the same as it was before, there is no need to resend these URLs as the old one will work just as well. Also, if you can find a way to turn off the RSS feed until after you import your posts, this will keep your feed subscribers happy as they won’t be inundated with 100s of new posts heh.

  2. I’m not sure how the feed pausing will work. Though, I believe if you are using Feedburner, then no update will take place due to the new posts.

    It’s good idea to disable pingbacks and trackbacks. Didn’t realize that WordPress sends off the links again.

  3. Thanks for the tutorial – it looks useful.

    A fairly severe \”gotcha\” when using WP’s export/import feature is that it doesn’t save post excerpts. Or at least, it didn’t last time I used it which was less than a year ago. I have excerpts for each post on ATMac and loosing all 200+ was not my favourite thing!

    So check that the WXR file really does have all your information such as excerpts and any custom fields you are using before you dump your old DB backup.

  4. That is great information to know Ricky. Honestly, I think their should be more details with regards to what the WXR file actually contains on the codex or on the Export page itself.

  5. I think, we don’t need to do export-import files mention in step 3 and 7, is that necessary ? I usually not and the posts are save, as long we don’t delete the wp-config.php and the database.

    1. This tutorial is only if you want to start from scratch and then import all your old posts. This cleans up the database, especially for those who have been using WordPress for several years now.

      For most users the normal upgrade is sufficient.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.