Change WordPress Multisite Primary Domain on Trellis Bedrock Install

Here are my quick instructions on for changing the primary domain name of a WordPress multisite that was installed with Trellis and is running on Bedrock from This update requires two simple steps. It’s quick and dirty. Not necessarily a best practice but it’ll get the job done.

Before you attempt! Did you backup your database? Is your new domain name pointed to the server?

Yes to both?
Ok, let’s get to work.

Note: This should work for any site using WP CLI installed, but I haven’t tested it recently.


    1. Using WP CLI search and replace your old domain with your new one.wp search-replace '' '' --skip-columns=guid --network
      Try doing a dry run first by addin the [–dry-run] flag to the end of your wp command
    2. Change your site variables in your .env file (wp-config.php for default WordPress).



Reload your primary site and you’re good to go!

Did you run into any problems?


Check your Config

Try adding or removing this from your ../config/application.php define('COOKIE_DOMAIN', env('DOMAIN_CURRENT_SITE'));

Error Establishing Database Connection

Make sure you used the --network flag in your command. There’s probably data that still needs to be replaced.

Try loading to generate a WordPress error screen with more information.


MySQL Tables for Changing Multisite Primary Domain

These are all of the tables that need to be edited
– 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.


Still stuck?

Leave me a comment and I’ll try to help!


This fast and easy tutorial is brought to you by the Digimix WordPress Developer NYC Team.