How do I change the primary Blog in WordPress Multisite

Marc Wag­ner

July 13, 2021

3 min read|

As a Word­Press agen­cy, we also sup­port com­pa­nies, agen­ci­es and schools that have crea­ted their web­site using Word­Press Mul­ti­si­te.

A Word­Press Mul­ti­si­te makes it pos­si­ble to main­tain seve­ral web­sites in one Word­Press ins­tance. You can easi­ly switch bet­ween the indi­vi­du­al web­sites via the Word­Press dash­board.

You also get access to a new area, the net­work admi­nis­tra­ti­on. From here, you can make glo­bal set­tings, install and acti­va­te plug­ins and the­mes for all Word­Press sites.

In addi­ti­on, you can log in to all Word­Press web­sites with Sin­gle Sign On (SSO). So you don’t have to remem­ber new access data for each page.

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

Chan­ges to wp-config.php as well as to the data­ba­se are neces­sa­ry in order to car­ry out the con­ver­si­on. So you need access to FTP and the data­ba­se, e.g. via PhpMy­Ad­min or Hei­diS­QL.

Step 1: Create a backup of your files and database

Befo­re you start to chan­ge your data, you should defi­ni­te­ly crea­te a back­up. Both for your data­ba­se and files. It is best to save the data local­ly.

Step 2: Edit the wp-config.php

You can find wp-config.php in the main direc­to­ry of your Word­Press ins­tance. It con­ta­ins all the important set­tings, inclu­ding the access data to your data­ba­se.

The­re we now have to look for the fol­lo­wing lines:

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

The num­ber (1) indi­ca­tes which ID was curr­ent­ly set. If you have a dif­fe­rent num­ber, it does­n’t mat­ter. This just means that your web­site has been con­ver­ted once.

To find out the IDs that you have to enter here, you have to open your data­ba­se via PhpMy­Ad­min or with Hei­diS­QL.

After­wards, switch to the data­ba­se in which your Word­Press data is loca­ted and open the table wp_blogs.

wordpress wp blogs multisite
Word­Press wp_blogs Table.

The­re you will now find the colum­ns blog_id and side_id as well as the asso­cia­ted domain and path.

Now enter the desi­red blog_id and site_id in your wp_config.php and save the file on your ser­ver.

Step 3: Adjust the Database

If you have skip­ped step 2, you now have to open your Word­Press data­ba­se in PhpMy­Ad­min or Hei­diS­QL. 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 ori­gi­nal page.

wp blogs vorher
Befo­re chan­ging the field domain within the table wp_blogs.
wp blogs nachher
After chan­ging the field domain within the table wp_blogs.

That’s it with the adjus­t­ment of the domain.

Step 4: Edit the table wp_site

Now switch to the table wp_site. The­re you will find an ent­ry with the fields’ id, domain and path.

Here, you have to make sure that the same ent­ry was made in the Domain column as in the wp_blogs table. So the ent­ry you chan­ged.

wp site table
Chan­ge the field domain within the Word­Press table wp_site.

Step 5: Adjust the table wp_post.

Final­ly, we still have to adapt the links for the con­tent that has alre­a­dy been crea­ted. This will adjust all links and images.

You can use the fol­lo­wing MyS­QL query for this:

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

Sim­ply replace the ent­ries ‘http: // old-url’ and ‘http: // new-url’ with the new domains.

That’s it.

Summary #

The default blog of a Word­Press Mul­ti­si­te can be chan­ged in just 5 steps. I hope you enjoy­ed the litt­le tuto­ri­al. If you do not trust yours­elf to adapt, we will be hap­py to help you. As a Word­Press agen­cy, we spe­cia­li­ze in this work.

Feel free to lea­ve us a com­ment if you have any ques­ti­ons or comm­ents.

88e86fcb816eff22bc917094df2862d8dd5c0e978b333e6dd5f36f808990c261 96

Arti­kel von:

Marc Wag­ner

Hi Marc here. I’m the foun­der of Forge12 Inter­ac­ti­ve and have been pas­sio­na­te about buil­ding web­sites, online stores, appli­ca­ti­ons and SaaS solu­ti­ons for busi­nesses for over 20 years. Befo­re foun­ding the com­pa­ny, I alre­a­dy work­ed in publicly lis­ted com­pa­nies and acqui­red all kinds of know­ledge. Now I want to pass this know­ledge on to my cus­to­mers.

Hast du eine Fra­ge? Hin­ter­lass bit­te einen Kom­men­tar
  1. blank
    Mar­tin July 23, 2024 at 13:50 — Rep­ly

    Thanks Marc, very clear artic­le! I’m only strugg­ling with the upload paths after chan­ging the domains. May­be you can wri­te a tuto­ri­al on this topic also?

  2. blank
    Han­nah Sep­tem­ber 5, 2024 at 05:48 — Rep­ly

    Hi Marc! All of the steps work­ed for me, howe­ver, on step 5, it said the­re was 0 matched rows when I simu­la­ted the query. I think it’s becau­se ins­tead of domain chan­ging, I updated the path.

    So for me it’s chan­ging domain.com/new to domain.com ins­tead of chan­ging new.domain.com to domain.com

    Is the­re a dif­fe­rent MyS­QL query to run if I chan­ged my path and not domain?