Migrating a Wordpress Blog to Wordpress MU

—————-

CREATE A NEW BLOG

Creating a new blog in MU is a super easy process, just click <site Admin>  then the <Blog> button. Fill out the form and away you go.

Take special note of the ID that WPMU gives your new blog. The ID is in the left most column of the blogs list.

picture-17

————–

MIGRATE YOUR DATA – THIS TIME FOR REAL!

Fire up phpMyAdmin, and take a look at your old blog’s database. You’ll want to export the following tables to a .sql file:

  • wp_comments
  • wp_links
  • wp_postmeta
  • wp_posts
  • wp_terms
  • wp_term_relationships
  • wp_term_taxonomy

Remember that ID from step 3? Open up the .sql in your text editor of choice, and globally replace “wp_” with “wp_{ID}_” (where {ID} is your blog’s ID).

————

And in wordpress mu this corresponds to: ~/wordpress-mu/wp-content/blogs.dir/{Blog ID}/files

I copied everything under ~/wordpress/wp-content/uploads to ~/wordpress-mu/wp-content/blogs.dir/1/files

I also used the following SQL command to update the post contents in the database: update WP_1_POSTS set POST_CONTENT = replace(POST_CONTENT, ‘wordpress/wp-content/uploads’, ‘wordpress-mu/wp-content/blogs.dir/1/files’)

—————-

replace the old url with the new

—————-

picture-18

Now point your phpMyAdmin at your WPMU’s database. You’ll notice in this database that you’ll already have tables with names like “wp_1_posts”, etc, so prefix all the tables with your blog ID in them with “old_”. The only table you’ll skip is “wp_1_options”.

Now that you’ve renamed those 7 tables, upload your .sql file into your WPMU database. You should now have a table list that looks something like the image to the right.

5. FIX AUTHOR OF POSTS

Last step! For every author in your old blog (probably just you), create a user in WPMU (if it’s you, it’ll be the MU admin). To assign all the posts to the admin MU user, run the following command in your MU database (substitute {ID} for the blog ID):

UPDATE wp_{ID}_posts SET post_author = 1

———

That’s it! You’ll probably want to log into the admin console and re-enable any plugins you need, and tweak your settings again. We omitted the wp_options table, so this process doesn’t import any blog settings at all. I tried importing settings as well, but hit a wall and was plenty happy to manually fix those.

At this very moment I am enjoying 1 admin panel, 1 click install for new blogs, 1 database, and 1 codebase. Simple. Upgradable. Trustable.

Enjoy your WordPress MU powered blog!

————

  • What about the wp_usermeta table?

    @eddihughes, I didn’t try moving the usersmeta since it wasn’t important in my case and I didn’t want to risk it. I’d try moving everything over except users+meta, then backup, then move users and meta and see how it works out. and better yet, report back here so we all know!
  • —————–

Leave a comment

Your comment