What do I have to do to change primary domain in multisite?


  • Nastia

    Hello juan , hope you're doing well!

    To change a primary domain name on a multisite you will require access to phpMyAdmin and change the URL inside site's tables. The tables that need to be edited are:

    - wp_options: options named “siteurl” and “home”
    - wp_site
    - wp_sitemeta: the option named “siteurl”
    - wp_blogs: any entries in the “domains” column that have the old domain name
    - wp_#_options: Each sub-site will have sets of tables that correspond to the blog_id in the wp_blogs table. You need to go to the wp_#_options table, where # corresponds to the blog_id, and update the “siteurl” and “home” settings in that table.

    Please make sure to create a full backup of your site. So if something goes wrong you can always restore your site back to the way it was.

    Also make sure to comment out any pre-defined constants in your wp-config.php file, as they will override settings in the database. Things such as:

    define( 'WP_HOME', '' );
    define( 'WP_SITEURL', '' );

    You can create backup with the Snapshot Pro plugin.

    The best practice is to have a development copy of your site, and test changing the site's URL there.

    Let me know if you have any further questions!

    Kind regards,