Recently, I started messing with a WordPress Multisite and figured it was about time to finally see what it was all about. I’ve always understood the basics of a Multisite, but never had a reason to venture into one, until now. My demos for my WordPress themes and plugins are now a multisite, which makes it easier for me to maintain.
If you don’t know what it is — it’s basically a single WordPress install that can provide many, many, many individual sub-sites, or child sites, using a single WordPress installation. In other words, just like how wordpress.com works. There are pros and cons to using a WordPress network which I am not going to go into details here, but rather how to export a sub site into it’s own standalone install.
There are two ways to go about it. First you can use the export/import tool under Tools to grab your content, pages, post, custom post types, etc and then import that xml file into your new install. Most of the time this will be fine, but it does not bring over your widgets, theme options, plugin options, or site settings. Your other option is to use a database dump and do a few find/replace commands. This in my opinion is the better option as you’ll have all the database information and settings. For either scenario, you’ll still need to FTP and download your theme, plugins and media library.
Let’s discuss using the second option. In our workflow below, we will be using #4 for our child site ID. This number will be different depending on which site you are exporting from your setup.
Before we begin, always make a backup!!!! And if you’re able, practice first on a local setup instead of live.
1. When you’re planning to export a subsite, you first need to see what you need. Using an FTP application, you’ll need to download the active theme (and child if using one) and the active plugins. Keep in mind, that you may have network enabled plugins which would not show on the sub site’s plugin admin page. So you’ll want to grab these too.
2. With multisite networks, each child site’s media library is placed into an ID number subfolder. So for example, if you’re going to export a child site with ID #4 (each subsite has a unique ID), using FTP, you’ll download the folder /wp-contents/uploads/sites/4/.
3. Now you’ll want to get a database dump. The best option is to use phpmyadmin and only dump the tables you need as there is only one database for all the sites in the network. When downloading the database, only download the tables with the site ID needed. So for our example, if we’re downloading site #4, the table we will need will start with wp_4_{table_name}. In addition to these, also include in your download the wp_usermeta, wp_users tables. Note that the “wp_” prefix may be different based on how you initially installed WordPress.
4. Now with a text editor, you’ll need to find and replace “wp_4_” with “wp_” within the database sql file you just downloaded. This will now match the wp_users and wp_usermeta tables that are already there.
5. Download a new copy and the same version of WP that you were using on the multisite to a folder on your computer. Copy over the theme and plugins into their usual places within /wp-content/. Next, take the media library that you downloaded and MOVE the contents of the /sites/4/ folder to /uploads/ in your new install.
6. Upload your new install to your server and import your edited database. In wp.config.php, change your credentials for the new database name, user and password and make any additional changes needed in this file for your setup.
7. Using a tool such as the Database Search and Replace script. You’ll need to find and replace a few entries. This script is great because it also accounts for serialized data. If you are changing domain URL’s, go ahead and do this here. Most likely you’ll need to as with a multisite the child site is either a subdomain or sub directory of the root, unless you were using domain mapping.
But most importantly, we need to change the URL’s of your media files. In the original child site, they would look something like the following: domain.com/wp-content/uploads/sites/4/2015/03/image.jpg. What we need to do is replace “/wp-content/uploads/sites/4” with “/wp-content/uploads”. Make sure you match if you are also including the last forward slash or not in your find and replace.
8. Login to the new install, re-save your permalinks and check your theme and plugin settings. They should all be there. Also, you’ll need to head over to users and remove any that should not be on this site.
If all goes well, you should have the child site now as a main site in it’s own install.
Hi – Thanks for the post. I’m stuck on signing in to the dashboard. Keep getting a “You do not have sufficient permissions to access this page.” when logging in with and admin account. Been checking the options and usermeta tables since that seems to be a common issue with the tags but I believe everything is correct. I’ve left the multi-site in place and using the same database so I renamed the tables and used search & replace to update the tags but still getting the error message. Suspect it’s something in either of those tables.
The admin account you’re using to log into the new stand alone site, did it have access rights to the subsite you moved? If not then you’ll need to assign this before doing it or go into the database and make sure the user ID has a role.
Perfect! That worked (thought the admin account on multi-site would have had access but it did need to be added to the specific blog).
The only thing that seem to remain is the permalinks for images seem to be “broken”. We use a lot of featured images for posts and none are showing. Image URL seems to be be fine. I’ve changed the permalink options and resaved a couple time but not luck.
Any suggestions?
Thanks,
Mark
How did you export the site content. As a database dump or using the Export Tool within WordPress? If it’s a database dump then it shouldn’t be an issue as Post Thumbnails are saved as an attachment ID. If you used the export tool this can be a hit or miss depending if you did a full export or partial.
I did an export of just the tables for the site using MySQL admin. I see the attachment name and it matches the id from the old site (with the proper dns change). For example:
Old site: http://blogs.mtlakes.org/themountaineer/?attachment_id=8891
New site: http://mlmountaineer.org/?attachment_id=8891
But, none of the images load in the Media Library. Meanwhile, the File URL is working fine and images are loading on the posts, it just seems to be the thumbnail. I did upload an image to a post and it loads fine with the same permalink form (/?attachment_id). I did notice that the permalink selection on the old and new site are actually Day and Name, not “default”
Sorry – forgot to mention that I did the upload test after switching to the default permalink option just to see if it might reset the permalinks.
How did you do the find/replace in the database. Did you use the tool I mentioned in the post or something else? I only ask because because I believe the post thumbnail would be serialized data?? Other than that, I’m not sure. It’s definitely tricky exporting a subsite. perhaps start over with the database import and find/replace.
You forgot to mention that you have to update the config file with the new prefix as well.
Hi Allen, Thanks. I’ve added a note to make any additional changes to the wp-config.php if needed.
Helpfull post! (even 2 years later 😉 )
Hi there. I assume this will still work as it’s now August 2019. We have set up a multisite install on a domain we own to offer cheaper websites in a particular niche, using sub-domains (some with domain mapping), on a minimum 12 month contract to ensure we make a base level of profit for each client site we build. if a client wishes to leave and take their site with them, we need to decide how much we would charge for the work involved in providing an export of the site for them. How long would this take do you think. Also, with a lot of client sites, exporting the users and then deleting the those not required seems messy, if there are a lot of users on a lot of client sites. Is there any way around that so yuou can only export the superadmin as a user and then just set up the client user account afterwards?
Not that I know of. Unless you use a plugin to extract the sub-site. ManageWP allows backing up individual subsites so that could be a way there. However, since you would be digging into the database, you could simply delete the users there. Or delete all users and create an admin user via
wp_insert_user()
I have multisite installed and in the dashboard I cannot see the “plugin” panel. The only way for me to see and use this panel is to go into Network Admin and network activate plugins. I tried moving to a single site (i don’t want the other one), but I cannot see the plugin panel in the dashboard anymore, although plugins are working!! any ideas?
Do you have a plugin that alters the admin based user or user role? Could be that if you do. Perhaps the menu is hidden with CSS. In the Multisite, there is a setting to allow site admins to have access to the plugins screen. However, if you’re a super admin then you should be able to view that in both cases.
Did you try access the page directly using the URL? /wp-admin/plugins.php