Skip to content

Instantly share code, notes, and snippets.

@dleone81
Last active May 23, 2018 21:33
Show Gist options
  • Save dleone81/b8e8e3ed3f5caeddba47096d17963aba to your computer and use it in GitHub Desktop.
Save dleone81/b8e8e3ed3f5caeddba47096d17963aba to your computer and use it in GitHub Desktop.
Wordpress changing site url in multisite environment.
# update config.php:
define('DOMAIN_CURRENT_SITE', 'www.newsiteurl.tld');
# update wordpress/wp-content/uploads/nginx-helper/map.conf
# this step works only for NginX webserver
# update wp_options table
UPDATE `db_name`.`wp_options` SET `option_value`='http://www.newsiteurl.tld' WHERE `option_name`='home';
UPDATE `db_name`.`wp_options` SET `option_value`='http://www.newsiteurl.tld' WHERE `option_name`='siteurl';
# repeat this step foreach wp_x_options where x = integer
UPDATE `db_name`.`wp_x_options` SET `option_value`='http://www.newsiteurl.tld' WHERE `option_name`='home';
UPDATE `db_name`.`wp_x_options` SET `option_value`='http://www.newsiteurl.tld' WHERE `option_name`='siteurl';
# foreach record within wp_domain_mapping table update url:
UPDATE `db_name`.`wp_domain_mapping` SET `domain`='www.newsiteurl.tld' WHERE domain = 'www.oldsiteurl.tld';
# foreach record within wp_blogs table update url:
UPDATE `db_name`.`wp_blogs` SET `domain`='www.newsiteurl.tld' WHERE domain = 'www.oldsiteurl.tld';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment