We understand this is annoying. But without advertising-income, we can't keep making this site awesome for you.
Please disable your adblock and script blockers to view this page. Appreciate! 🙏
Home English Articles How to Switch Sub Site to Primary Site in WordPress Multisite

How to Switch Sub Site to Primary Site in WordPress Multisite

switching multisite primary site

How to switch sub site to primary site in WordPress Multisite.

Recently, I start my personal blogging and want to monetise my site with Google Adsense. However, I realize that a sub domain or sub site could not be approved by Google. As a result, google only approved for monetizing in your main domain.

For example: www.maomaochia.com

blog.maomaochia.com (not approved)

Due to this, I do a lot of research and try to seek for experts to answers and solve my problem. I am using WordPress Multisite for the site building. I don’t want to redesign the whole main site to the blog site that I wanted to switch to. Because this will cost a lot of time and efforts.

After a lot of testing, I’m finally turn my Multisite sub site (blog.maomaochia.com) in to primary main site (www.maomaochia.com).

Quick go:

This methods is switching the site content including pages, posts, users and etc. If you are facing the same problems with me, you could try this methods. Explaining on the below.

A. Learn how’s Multisite works.

1. Check the site you want to switch.

You can see my wordpress multisite primary landing page design (Maomaochia.com) and subdomain design (blog.maomaochia.com). I want to switch the whole website from blog.maomaochia.com to www.maomaochia.com.

2. Define of wp-config.php.

From the site cpanel > wp-config.php, we can see SITE_ID_CURRENT_SITE = 1, BLOG_ID_CURRENT_SITE = 1.

3. PhpMyAdmin

Go to phpMyAdmin open the database, check the file [name]_blogs, we can see the current settings blog_id are different. From here we know wordpress use this to define sub site in multisite.

*the [name] is the database name, you must find the right database of the site.

4. Options Table

Now search “options”, you can see there are few options file. Each options define sub site in your WordPress multisite.

Check the [prefix]_6_options, site url is blog.maomaochia.com.

From the above you know that, wordpress how to define every subdomain in multisite. Once you create a new site in your wordpress multisite, here will automatically generate a new file name accordingly in your database. For example 10_options, if you create 10th subsite in multisite.

B. Start switching sub site to primary site domain.

Read carefully the whole writing before you go into the process.

1. Before switching, backup your site!

You could try WordPress Backup and Migrate Plugin – Backup Guard this is a free plugin for WordPress Multisite backup. Network active and go to backups, you can choose to full backup or custom backup database or files only.




2. Duplicate both site you want to switch.

Download MultiSite Clone Duplicator By Julien OGER, Pierre DARGHAM, David DAUGREILH, GLOBALIS media systems, network activate, duplicate both site and name to any address you like (just for another backup purpose).

Sites > Duplicate

Choose the Original site to copy > Name new site address and title > Site admin email > Click [Duplicate]

*If you want to move your current primary site to another subdomain, name the site address to the new subdomain.

3. Edit database in phpMyAdmin.

In my case, I want to switch my blog.maomaochia.com to www.maomaochia.com.
Search and open blog.maomaochia.com options table (located in [name]_6_options in my case), edit the siteurl and home column “option_value” to “https://maomaochia.com”.

Also, editing maomaochia.com options table (located in options), edit the “option_value” to “http://blog.maomaochia.com” as below.

After edit both options table, search and go to [name]_blogs change the (maomaochia.com) to (blog.maomaochia.com) in blog_id 1 column and (blog.maomaochia.com) to (maomaochia.com) in blog_id 6 colume. Demo below.

4. Edit wp-config in file maneger.

Open wp-config.php, change the BLOG_ID_CURRENT_SITE to ‘6’ (in my case) and click [Save].

5. Transfer media.

Now we have done in server site, refresh your wp-admin and you will see your primary site have been change. However, your media become unusable but luckily we’ve already backup.

 To fix this, simply delete all the unusable media, go to the backup site we created before > Tools > Export > Install and Run WordPress.

Select Media > Start from the older to latest date > Click [Download Export File]


Go back and import the file back to the site.

Once finish uploading the .xml file you will jump to the page like this, assign posts to an existing user choose yourself and check ‘Download and import file attachments’, submit.


 6. URLs Correction.

Surprise, now you can see your media is back.

Some link remain on the old urls, here is how we change it.

Download Velvet Blues Update URLs By VelvetBlues.com free plugins.

Type your old URL “blog.maomaochia.com” and new URL “maomaochia.com”, check all except “Update ALL GUIDs” and [Update URLs NOW].


Congratulation you have successfully switch your WordPress Multisite sub site or sub domain to the primary domain site. This is the way i switch my site, if you are facing the same problem, you could try this methods yourself. But before you do anything please do backup your site, i don’t responsible if your site down or crash.

Welcome to MAOMAO Blog, and thank you for reading this writing.
If you have any questions, you can comments below, find me on facebook, instagram or whatever any way. I really like to hear from you.


maomao February 22, 2018 - 3:44 pm

Contact me for any problems . 🙂

anastasia September 6, 2018 - 4:53 pm

I think this is relevant to my current problem but I totally lost with all of these hahahahaha.
Do you have any recommendation for one stop package : website builder and hosting ?

maomao September 6, 2018 - 6:09 pm

For hosting I recommend Siteground. CMS still is wordpress


Leave a Comment

You may also like