WordPress plugins, themes, tips and hacks

6 things to remember when moving WordPress blogs to a different host

Tuesday, July 8th, 2008

I recently had to move all my WordPress sites and blogs to a new server because Bluehost sucks. My sites were going down on a near-daily basis for way too long, and they couldn’t care less. So I did what I really did not want to do, and moved six WordPress sites to a new hosting provider, which has proven itself with my clients’ sites: Hostgator. And along the way I’ve learned quite a few things about what to pay attention to when moving WordPress sites from one place to another, which I’d like to share.

Lesson 1: WordPress’ native XML export is not good enough

In WordPress, you can easily export a site by going to Manage > Export, which will create a unique XML file that you can import in any new site. This is fine for a very simple, single-user blog without heavy customizations. However, if your blog has multiple users, and if you have added info to their profiles, that info will be lost in this export. In addition, all users will be given a permission level of Subscriber, which is annoying if you need to go and change everyone back to their original permission level.

Also, if you have installed plugins that created new tables in your database, these will not be exported.

And, if you had any links saved, this will not save your links. See Lesson 6 below for more information on this, but the point is that the only way to save your links AND their categories is to export your entire database.

Therefore, in order to retain all settings and information that your site needs, the only way to do so is to export your entire database, and then import it to the new WordPress installation.

Exporting and Importing a WordPress blog

Here’s how you export and import your WordPress database. WARNING: Messing with databases in PHPMyAdmin can be hazardous to your health and to the health of your site. One wrong move and everything will be but a distant memory. So make sure to backup like crazy; and I take no responsibility for any harm you may come to by following my instructions. Now, let us begin:

  1. Log in to PHPMyAdmin via your control panel or however else you log in.
  2. If you have multiple WordPress blogs on one server, you may see a list of databases in the left-hand sidebar. Make sure you are dealing with the right database. The way that I check which database is the right one is by browsing the database and viewing the information there, whether it’s posts or even meta data like the blog name. To browse, click on the browse icon next to a table’s name (Note: your PHPMyAdmin interface may look a bit different, depending on the version you are using):
    Browse database tables in PHPMyAdmin
  3. Once you are sure you are in the right database, click on Export at the top of the PHPMyAdmin toolbar:
    Export database in PHPMyAdmin
  4. On the Export screen, I usually leave all the settings as is, but I do make sure to to 2 exports: a compressed (gzip) export, and a regular export, just in case. So export one while selecting None, as shown below, and one while selecting gzipped:
    Compress export file in PHPMyAdmin
  5. Now on to importing: install WordPress on your new server.
  6. Go in to PHPMyAdmin for your new server, and delete all your tables for your new WordPress installation (Yikes!). In PHPMyAdmin, to delete is called to “drop.” So on your main database page, select all your tables and click on Drop, or on the red Xs next to the table names:
    Drop tables in PHPMyAdmin
  7. Now, import your exported WordPress database into your new installation. To do that, stay in PHPMyAdmin for your new site, and click on the Import tab that is to the right of the Export tab on the toolbar (see image in step 3 above).
  8. Browse to find your exported database file. Leave the rest of the settings, and click Go.
  9. Now your old WordPress database is in your new installation. It may work at this point, so go check. If it does, great. If not, continue reading.
  10. You need to make sure that your database table names work with the new installation of WordPress. This means the following: if you installed your old database with Fantastico, all your database tables have a prefix of wp_. If you didn’t install it with Fantastico, the database tables probably don’t have a prefix. Your new database tables may have a different naming convention depending on how you installed it. So, take a look at your database table names, and note if they start with wp_ or not. Now it is time to open wp-config.php.
  11. Once you have opened wp-config.php, look at line 16, which says something like this:
    $table_prefix = ‘wp_’;
    If your database tables start with the wp_ prefix, leave the line as above. If they don’t have a prefix, change it to:
  12. $table_prefix = ”;

Now your blog should mostly work (I hope)! But there are a few more things that we need to take care of:

Lesson 2: Widgets are not preserved with an XML backup, even with a full database backup

If you are using widgets somewhere in your blog, you will have to redo them one by one on your new blog if you use the XML backup. So take out a pencil and paper, and write down exactly what widgets you are using, what order they’re in, and any modifications or customizations that you made to them. Ok, you can use Word or Notepad if you want, but that’s about as technologically friendly as you can get.

Lesson 3: In addition to backing up your theme and plugins folder, remember your Uploads folder!

In your blog under Settings > Miscellaneous, you have set where any uploaded files or images will be stored. Make sure to backup that folder, in addition to your theme and plugins folder, so that you will have all those files in your new blog. In your new blog, go to Settings > Miscellaneous and make sure it’s pointing to that re-uploaded Uploads folder.

Lesson 4: Make a note of your site’s permalink structure

You want to retain the same permalink structure for your new site so that you can continue to enjoy the same traffic you had before from search engines and incoming links. So make note of your permalink structure, and once your new blog is installed, make sure to go to Settings > Permalinks, and set the same structure there.

Lesson 5: Don’t forget your favicon

Your favicon can get lost in the shuffle. Make sure to back it up, and upload it to your new site.

Lesson 6: It is hard to preserve WordPress blogroll links and their categories

Here at WordPress Garage, I had a page until recently called “Links we Love.” I had painstakingly added, categorized and described many links that I thought were useful to my readers. Well, during the whole server move, the links got lost because we didn’t export them by going to http://wordpressgarage.com/wp-links-opml.php, and saving that OPML file as a text file for importing later. In any case, even if I had saved that and imported it here, I would have lost all my categories anyway. So just note that if you’re depending on the XML backup, you will lose all your links. If you back up your links with the OPML file, you will lose your categories.

——————-

To sum up: try not to ever have to move your WordPress blog from one server to another, and you will add years on to your life.

Happy blogging!

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

5 steps to a smoother WordPress upgrade

Tuesday, October 30th, 2007

Someone just left a comment here on WordPressGarage saying that he upgraded his wife’s WordPress blog and lost all the categories. He wanted to know how he could get them back. I asked him if he had backed up the blog before upgrading, and he sadly said no.

First of all, that’s why I hesitate to upgrade. Disaster can strike at any time, and it has struck others. But there are steps that you can take to make your WordPress upgrade smoother, and here they are:

  1. Backup, backup, backup!! I don’t care how you do it, but if you care about the posts you’ve written, then make sure you back them up on a regular basis. You can do this through PHPmyAdmin, but if that’s not your thing (which is understandable), then become familiar with WP-DB-Backup. This plugin can be set to backup your database and email it to you daily, weekly, or monthly. By using this plugin, you can get rid of the headache of remembering to back up on a regular basis.
  2. Deactivate all your Plugins!! Now you can do that in one click on your Plugins page by clicking on the Deactivate all Plugins button at the end of the list of Plugins. If you don’t do this, your whole upgrade could bork (if that’s a word).
  3. Use Fantastico!! When you are looking for a host for your site, ask them if they have Fantastico. Fantastico enables you to install all sorts of Open Source applications in one click, including WordPress. It also enables you to upgrade in one click, so once you’ve backed up and disabled your plugins, log in to your control panel, go to Fantastico, click on WordPress, and choose the blog you want to upgrade. The one drawback with Fantastico is that they don’t provide upgrades very quickly. The last time I checked, you still couldn’t upgrade to WordPress 2.3 with Fantastico. But it’s worth the wait.
  4. If you don’t use Fantastico, follow the WordPress upgrade instructions VERY CAREFULLY! Don’t try to outsmart them or skip anything, or you will pay…
  5. Use the Maintenance Mode plugin while upgrading or otherwise messing around with your WordPress blog. Maintenance Mode puts a splash screen up on your site that tells visitors the site is undergoing maintenance, and they should check back later. You can still login to the admin, and even see the front end of your site as you make changes to it.

Happy upgrading!

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Fantastico now offers WordPress 2.2. upgrade and install

Monday, June 4th, 2007

Fantastico has now been set up to allow upgrades and installations of WordPress 2.2. So I took the plunge and upgraded almost all of the sites that I manage. Each site took about five minutes, and so far I haven’t noticed any problems.

I want to take this opportunity to laud the praises of Fantastico, and recommend that you choose your hosting based on whether they offer Fantastico or not. Installation with Fantastico takes about five minutes, as opposed to having to upload the entire WordPress directory via FTP on hosting providers that don’t offer Fantastico, a process which can take almost an hour if your FTP connection fails too many times. Especially if you are running a WordPress site, Fantastico can make your life a lot easier since new versions of WordPress are released relatively frequently.

Upgrading with Fantastico is also really simple, and involves the following steps:

  1. Backup your WordPress files. I use WordPress’ export feature, which is available under Manage, and I use the WordPress Database Backup plugin from Il Filosofo and save the backup file.
  2. Deactivate all plugins. A little tedious, but not too complicated or time-consuming.
  3. Log into your cPanel. Click on Fantastico. Click on WordPress in left-hand column. Click on upgrade next to the relevant installation.
  4. You will receive a warning before the upgrade takes place. Click upgrade and in a few seconds the upgrade is complete.
  5. Log in to your WordPress site. Re-activate all the plugins.
  6. Take a look around and make sure things are ok.

That’s it! So now WordPressGarage is running on WordPress 2.2. If you see anything weird, please let me know.

For more information on Fantastico:

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]
Premium News Themes