How to change a multisite primary domain

WORDPRESS-black-ink-grunge-stamp-textures-icon-social-media-logos-wordpressIf you want to change the primary domain of your WordPress multisite installation, there are 5 values to change. There is no need to perform a database dump. This is actually frowned upon, as WordPress stores serialized data in the database, and altering it can cause corruption. Here is a list of the 5 main tables and options that need to be changed (note that we’re assuming your table prefix is “wp_”. If you’re using a different table prefix, replace “wp_” in the following table names with your prefix):

  • 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.


I had a need to do this today and whilst it was a little bit “tricky”, the process has been well documented at WP engine What appears above the horizontal rule above is directly from WP engine (as it appeared on 2014-11-23). I have only pasted the outline above mostly for my reference, but for anyone else if they find it useful. For a complete walk-thru on how to complete the task, I urge you to visit the WP Engine website.

I will add, I did have to change one more reference to the old domain, and that was in the

wp-config.php

file. There was a multisite reference:

define('DOMAIN_CURRENT_SITE', 'my-old-domain-name.com');

reference:

  • http://wpengine.com/support/how-to-change-a-multi-site-primary-domain/
  • http://codex.wordpress.org/Changing_The_Site_URL

Leave a comment