Moving to WordPress 3.0

Since I’ve already taken the plunge and moved over to WordPress 3.0 and consolidated my various separate WordPress 2.X installs to it, I thought it would be good to document the process I used to try and help others who might be wary of taking the plunge. There are unlimited ways that you may have your particular install set up, so this may or may not apply. Do not fold, spindle, or mutilate.

It may be obvious, but before you do ANYTHING with your WP install, back up your files and your database. Backing up your files is as easy as downloading your install directory locally via FTP, and if you aren’t familiar with how to back up your database (YOU SHOULD BE BACKING UP YOUR DATABASE REGULARLY) there are good instructions here. Go back up your site, and come back when you’re done.

Everything safe? Ok, now…you want to go to your WordPress dashboard, hit Tools, and Export. What you’ll get is an XML file of all the content from your blog: posts, categories, tags, authors, etc. Save this in a very, very safe place. This is the file that you will use to import your blog into your new WP 3.0 site. Repeat this step for every blog you hope to move, renaming the Export file into something recognizable.

In my particular instance, I had a site set up that went like this: at the root level of my website, I had just a flat HTML file that was my homepage. I had two different WordPress 2.X installs in subdirectories (/wp and /eliza). What I wanted to do was to install WP3.0 in my root directory, and then use the Multisite functionality built in to WP3.0 to re-create the /wp and /eliza blogs, running in the single root-level install.

After backing everything up, I went ahead and installed WP3.0 in the root directory. There is then one bit of manual code you have to add in order to enable multisite capabilities. In your wp-config.php file, just before the line

/* That's all, stop editing! Happy blogging. */

You need to add the line

define('WP_ALLOW_MULTISITE', true);

This enables multisite capabilities. You’ll have to do a little bit of copy/paste into your .htaccess file, but WP walks you through it. When you log into your install again, you’ll see a new set of controls in your dashboard relating to these new capabilities.

One more bit of editing is needed before you move on to creating new blogs and importing your XML files into them…by default, WordPress filters imported XML by removing possible troublesome tags…unfortunateely, including things like <embed> and <iframe> and other instances where you’ve included content in your posts. WordPress does so via a file you can find in /wp-includes called kses.php. In kses.php, you’ll want to scroll down to line 1309 and comment out the three lines under //Post filtering so that they look like this:

// Post filtering
#add_filter('content_save_pre', 'wp_filter_post_kses');
#add_filter('excerpt_save_pre', 'wp_filter_post_kses');
#add_filter('content_filtered_save_pre', 'wp_filter_post_kses');

This will prevent the filter from removing all your youtube videos, slideshare embed, scribd documents, etc. Once you’ve altered the filter and saved it, you’re ready to create your new blogs, hit the Tools menu, and import your XML from your exports above. After the process completes, you should have a working blog with all of your previous content in place exactly as before.

For my particular case, it was important for me to maintain the existing directory paths for /wp and /eliza so as to not break tons of incoming links…WP3.0 handles that perfectly. After all this, I now have WordPress running at the root level of jasongriffey.net, Pattern Recognition and Brand New World working exactly as they were with the separate installs (including permalinks!), and will be moving my previously flat-file homepage into WordPress pages. I’ve got my whole site running on WordPress, and the ability to create new blogs at will in order to expand my setup.

I’m chuffed about the setup, and really, really excited about the possibilities with WordPress 3.0.


About this entry