Home > Article > CMS Tutorial > Retargeting WordPress: Transferring Website from Multisite Network
Sometimes a site is already created in a WordPress multisite network but needs to be moved to its own single-site installation. There are several situations in which this may occur, including:
In some cases you may find that you can move a site out of multisite using a plugin or combination of plugins, but if this doesn't work you will need to move the relevant database tables. Moving a site out of a multisite network in this way is a tricky process because it involves isolating the database tables in the multisite database that are relevant to that specific site. But it's not impossible.
To follow this tutorial you will need:
Note: You cannot move the primary site out of a multisite network because the network will not workwithout it. If you do need to move your main site's content elsewhere, I recommend creating a copy and then replacing the original site's content with a dummy site. However, you won't be able to move the domain because it's also used by every other site in your network.
If your website doesn’t have extensive configuration via plugins, themes, or website settings screens, you can successfully move it using the WordPress Importer plugin. If your website has widgets, you can copy their settings using the Widget Settings Importer/Exporter plugin.
However, if you added a lot of custom configurations using the settings or options screen or the theme customizer, none of these configurations will be copied. In this case, you need to move manually.
For full details on how to use these plugins to move your site, see my previous tutorial on moving a WordPress site using plugins. The process is exactly the same as moving a site from a multisite network to its own WordPress installation.
The site you are moving out of Multisite will contain three components that you need to copy from the Multisite network:
wp-content/uploads/sites
Note: If your multisite network was created before WordPress 3.5, you will not have a sites
folder. Instead, you will have a blogs.dir
folder in wp-content
that contains all the uploaded files for the subsite. This will give you a numbered folder for the site you want to migrate, which you can copy . I'll cover this in more detail below.
Before you begin, consider why you want to move your site. Is it just to change to a new domain name? If this is the case, then a free domain mapping plugin will allow you to give each site its own domain, and your visitors will never see the domain of your multisite network.
But if that’s not the only reason, keep reading!
Before performing such operations, it is a good idea to back up your multisite installation. Use your favorite backup plugin, or if you prefer to work manually, use a combination of FTP and phpMyAdmin.
You will use this backup to copy relevant files to your new website and also give you peace of mind in case of any issues.
Each site in a multisite network has its own unique numerical ID. This is used to identify folders in the wp-content/uploads/sites
directory (or wp-content/blogs.dir
if you have an older multisite network, see above ) and identify the site's database tables.
You can find this by going to Network Management > Sites and selecting the Edit option for the site you are using. The URL that WordPress directs you to will provide you with the ID of your website. The URL should be in the format http://mynetwork.com/wp-admin/network/site-info.php?id=XX
.
XX
is the ID of your site, and will be the name of the folder containing its files, and the prefix of its database table name.
p>
Since you are only moving a subsite and not the entire installation, you do not need the contents of the entire database.
In PhpMyAdmin, click the Export tab. Then find the table related to the site you want to export. They will start with wp_XX_
, where XX
is your site's ID. An example is shown below.
Select all tables related to your subsite and export them.
Note: WordPress Multisite stores all data related to web users in the wp_users
and wp_usermeta
tables: it does not create separate data for each site. If you have a lot of users on your site that you want to copy from the web, you may also want to export these tables, import them to the new site and edit the users in the admin screen to remove any non-existent users. Related to the new website. However, if your site only has one or two users, it will be easier to recreate the users on the new site. For more information about multisite and database tables, see our tutorial on WordPress databases and multisites.
Copy the sql
file that was downloaded to your computer and give it a name (for example, add copy
to its name). Open it in the code editor.
Change all instances of a site domain in a multi-site network to their new single-site domain. For example, if your site is at http://network.com/mysite
, change it to http://mysite.com
. If your network uses subdomains, you will need to change all instances of http://mysite.network.com
. If you do this, I recommend you also run check subdirectory versions just in case. Save your file.
Note: If your site is mapped to a domain that is not the one you are moving it to, you will also need to replace it with the new domain. Be very careful here and keep backups!
The database tables in a new single-site installation will not have the site ID prefixed, so you need to delete them. In the sql
file, replace all instances of wp_XX_
with wp_
, where XX
is your site ID. p>
Now save the sql
file.
In phpMyAdmin, create a new database in the location of your new site and install WordPress in the normal way.
Identify the plugins used by the subsite and install them into your new WordPress site via the Plugins screen or upload them from your backup of the old site.
Do the same with any themes your site uses - copy them from the backup to the wp-content/themes
directory of your new standalone WordPress installation, or just reinstall them.
Copy upload content from old website to new website:
sites
folder in wp-content/uploads
. Find the subfolder that contains your site ID and upload its contents to the wp-content/uploads
folder in your new site. blogs.dir
folder, that folder will also contain a folder containing your website ID. There will then be a subfolder named files
. Copy the contents of the files
folder to the wp-content/uploads
folder in the new website. Note: You may need to delete any folders WordPress created in the new uploads
folder to avoid any conflicts.
After completing all this, activate all themes and plugins.
Now that you have the theme and plugin installed, you need to import the database tables.
Before uploading the table from the old website, you need to delete the duplicate table that WordPress added to the new website.
In phpMyAdmin, delete the following tables from the database:
wp_commentmeta
wp_comments
wp_links
wp_options
wp_postmeta
wp_posts
wp_terms
wp_term_relationships
wp_term_taxonomy
Screenshot showing my database with only these tables selected:
Select them, click the Select: drop-down box, and select Delete. When prompted, click Start.
Note: Do not delete the <em>wp_usermeta</em>
or <em>wp_users</em>
table , unless you also choose to copy these tables from the network (see above).
Next upload your edited database:
Clear your browser's cache. This avoids any issues you might encounter if your browser has cached content from an older website.
Now log in as the WordPress administrator of the remote site. If you move the users table, your login details will be the same as on the old site, but if you didn't, these details will be what you specified when you installed WordPress in the new location.
Visit the Permalinks screen and reopen the beautiful permalinks.
Check that all your links are working properly and widgets and plugins are functioning as they should. If not, you can fall back on the process and use backups where needed, or just set up plugins and widgets in your new site.
Once you are completely satisfied that everything is working properly, remove the site from the multisite installation. I recommend leaving it on for a week or so in case you notice anything that hasn't been moved. In the meantime, you can use a plugin or configure the old site's domain in CPanel to map to the new site.
Yo! It's a long and slightly complicated process, but you're done.
Moving a site from WordPress Multisite to its own installation is not something that can be done quickly or thoroughly, but it is possible and I have done it a few times. If you follow the steps above and make sure you have a backup in case anything goes wrong, you should find that it goes smoothly for you.
The above is the detailed content of Retargeting WordPress: Transferring Website from Multisite Network. For more information, please follow other related articles on the PHP Chinese website!