How do I change the primary Blog in WordPress Multisite

Marc Wagner, July 13, 2021

As a WordPress agency, we also support companies, agencies and schools that have created their website using WordPress Multisite.

A WordPress Multisite makes it possible to maintain several websites in one WordPress instance. You can easily switch between the individual websites via the WordPress dashboard.

You also get access to a new area, the network administration. From here, you can make global settings, install and activate plugins and themes for all WordPress sites.

In addition, you can log in to all WordPress websites with Single Sign On (SSO). So you don’t have to remember new access data for each page.

How do I change the default blog of my WordPress Multisite? #

Changes to wp-config.php as well as to the database are necessary in order to carry out the conversion. So you need access to FTP and the database, e.g. via PhpMyAdmin or HeidiSQL.

Step 1: Create a backup of your files and database #

Before you start to change your data, you should definitely create a backup. Both for your database and files. It is best to save the data locally.

Step 2: Edit the wp-config.php #

You can find wp-config.php in the main directory of your WordPress instance. It contains all the important settings, including the access data to your database.

There we now have to look for the following lines:

define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

The number (1) indicates which ID was currently set. If you have a different number, it doesn’t matter. This just means that your website has been converted once.

To find out the IDs that you have to enter here, you have to open your database via PhpMyAdmin or with HeidiSQL.

Afterwards, switch to the database in which your WordPress data is located and open the table wp_blogs.

wordpress wp blogs multisite
WordPress wp_blogs Table.

There you will now find the columns blog_id and side_id as well as the associated domain and path.

Now enter the desired blog_id and site_id in your wp_config.php and save the file on your server.

Step 3: Adjust the Database #

If you have skipped step 2, you now have to open your WordPress database in PhpMyAdmin or HeidiSQL. Then switch to the wp_blogs table.

In order to set the new blog page as the start page, you now have to adjust the ‘domain’ column. Here, you now have to enter the value from the original page.

wp blogs vorher
Before changing the field domain within the table wp_blogs.
wp blogs nachher
After changing the field domain within the table wp_blogs.

That’s it with the adjustment of the domain.

Step 4: Edit the table wp_site #

Now switch to the table wp_site. There you will find an entry with the fields’ id, domain and path.

Here, you have to make sure that the same entry was made in the Domain column as in the wp_blogs table. So the entry you changed.

wp site table
Change the field domain within the WordPress table wp_site.

Step 5: Adjust the table wp_post. #

Finally, we still have to adapt the links for the content that has already been created. This will adjust all links and images.

You can use the following MySQL query for this:

UPDATE wp_posts SET post_content = REPLACE (post_content,'http://old-url','http://new-url');

Simply replace the entries ‘http: // old-url’ and ‘http: // new-url’ with the new domains.

That’s it.

Summary #

The default blog of a WordPress Multisite can be changed in just 5 steps. I hope you enjoyed the little tutorial. If you do not trust yourself to adapt, we will be happy to help you. As a WordPress agency, we specialize in this work.

Feel free to leave us a comment if you have any questions or comments.

Avatar of Marc Wagner
Marc Wagner

Hi Marc here. I'm the founder of Forge12 Interactive and have been passionate about building websites, online stores, applications and SaaS solutions for businesses for over 20 years. Before founding the company, I already worked in publicly listed companies and acquired all kinds of knowledge. Now I want to pass this knowledge on to my customers.

Similar Topics

Comments

  1. Hi Marc! All of the steps worked for me, however, on step 5, it said there was 0 matched rows when I simulated the query. I think it’s because instead of domain changing, I updated the path.

    So for me it’s changing domain.com/new to domain.com instead of changing new.domain.com to domain.com

    Is there a different MySQL query to run if I changed my path and not domain?

Leave A Comment