Migrating Your Current WordPress Blog to a WordPress Multisite Blog

    Bernard Peh

    Last month, I wrote and presented a video about how to host multiple sites in WordPress 3.0. This raised the question of what to do if you already have multiple WordPress sites and would like to bring them together to leverage the power of the WordPress multisite feature.

    Until recently, migrating all your blogs to a single multisite blog was a massive task because of the need to resolve conflicting IDs across different tables. Fortunately, newer WordPress versions have built-in functions to make life a bit easier for all of us.

    You’ll find the official WordPress multisite migration documentation here, but I’m going to give you a summary of the process here, plus another video on the topic. Here’s the video:

    [vimeo 20772164 600 375]

    In this summary, I will use “multisite” to refer to the master WordPress blog, “singlesite” to refer to the single WordPress blog that you want to migrate over and “newsite” as WordPress installation that acts as a placeholder site in a subdirectory under “multisite”. The content from the “singlesite” will need to sit in “newsite” before domain migration occurs.

    The first thing to do is make some preparations.

    Make sure you have the latest version of WordPress installed: we’re up to version 3.1 now. This is important for consistency between installations and also to ensure you have access to the multisite feature. Upgrade WordPress if necessary and ensure the multisite feature is enabled. Check the previous video for details.

    Back up all databases for both multisite and singlesite.

    Do not activate domain mapping for newsite yet.

    This is a good time to do a bit of housekeeping and remove all old spam comments, expired users and unwanted posts on singlesite. You will reduce unwanted content and make your life a little easier later on.

    Copy the theme and plugins from singlesite to multisite. How you achieve this depends on how your sites are hosted. You may need to use cPanel or similar, or stand alone FTP.

    The next step is to export the content of singlesite to a downloadable file. In the singlesite WordPress admin panel under Tools in the left sidebar, click on Export. Click on the Download Export File button to export the content of the site to an xml file.

    Switch your attention to the newsite WordPress installation. To import the singlesite xml file we have just exported, we need to install a plugin. Click on Add New under Plugins in the left sidebar of the admin panel and search for the term “WordPress Importer”. Follow the instructions to install that specific plugin.

    Then go to Tools / Import, click on WordPress and upload the singlesite export xml file. Proceed with the import only up to the Assign Authors page.

    At this point, you’re given the option to map the authors from singlesite to newsite. This is the most challenging part of the process because WordPress does not allow you to have duplicated authors across different sites in your multisite, so you need a way to identify and resolve the duplicate authors.

    To do this, you can compare author usernames and email addresses.

    Go to phpMyAdmin for the singlesite database. Duplicate the wp_users table, call it wp_users_tmp and then export this table. Then switch to the multisite database and import wp_users_tmp.

    To compare the wp_users table from both databases, run this query on the multisite database to give us a list of all email duplicates.

    SELECT t.user_login as singlesite_user, w.user_login as multisite_user, w.user_email
    FROM wp_users w, wp_users_tmp t WHERE w.user_email = t.user_email

    Now run this query to check for any username duplicates.

    SELECT t.user_login as singlesite_user, w.user_login as multisite_user, w.user_email
    FROM wp_users w, wp_users_tmp t
    WHERE w.user_login = t.user_login and w.user_email != t.user_email

    Back on the Assign Author page in the multisite import process, append “_singlesite” or another unique identifier to the existing singlesite username for any case where a user is duplicated.

    Check the Download and import file attachments checkbox and click Submit.

    Since all users now have unique names, you can compare them against the profiles you have in singlesite. Now, you can manually enter their profile details in the users section.

    Re-activate all the plugins and re-setup the widgets in newsite. You can also configure the theme under Superadmin / Sites.

    Point your browser to http://multisite.something/newsite/and check that newsite now holds the content of the singlesite.

    Change the IP address of the singlesite domain to point to your multisite host.

    Add the singlesite domain as the primary domain under Superadmin / Domains.

    This migration process is much more complicated than the previous process and I suggest you watch both the first and this latest video to thoroughly familiarize yourself with the process before you tackle it.

    I hope this will help you if you are thinking of migrating your WordPress blog. That’s it for now.