Restoring a single WordPress site to a Network

I’ve been attempting to move my localhost development copy of a WordPress environment to a test site on a client’s server. When talking it over with the team, we decided that the test site should be a WordPress network with one site for testing, and one site for production. This will allow for a much more manageable environment in the future, but presents an initial problem.

The Problem

I want to do a database transfer from my localhost WordPress install to a web server running a WordPress network. However, I can’t blindly drop the DB and import my own because multiple options are set differently and there are extra tables in the network DB. I would use an export / import with the XML file, but that wouldn’t be able to download my media files, not to mention the plugin configuration & widget settings.

7 of 9 from star trek: voyager
“Insufficient”

After mulling it over a bit, the easy solution hit me.

The Solution

Why not first restore my localhost WordPress DB to a single install on a web server, then use the export / import XML on the network! I’m still out the plugin settings, but at least my media files can be downloaded. For this particular project, the site had hundreds of media files and 1 plugin, so I figured that option was close enough. Here are the steps I took in list form:

  1. Export localhost DB
  2. Install a single (non-network) WordPress on a web server
  3. FTP plugins, themes, and uploads to the single site
  4. Drop / Import the localhost DB to the single site
  5. Edit the DB to replace all URLs as appropriate -> eg change all “localhost:1337/dev” instances to “example.com” (I like this tool)
  6. Create the export XML from the single site ->Dashboard > Tools > Export
  7. Import the file to the appropriate site on the network, selecting to download file attachments after the upload
    wordpress import media files
  8. All done. Yay!

 

Leave a Reply

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