These are SQL queries to change the home url in the wp_options table in the WordPress database. For a single site, just use the first line. You can also change it for all sites in a Multisite network. This example includes lines to change 8 sites in your multisite network. For each additional site, add a new line and change “wp_8_options” to “wp_9_options”, and increment the number accordingly. Note that “wp_#_options” appears twice on each line, so make the change in both places on each extra line that you add.
On all of these lines, change ‘DATABASE_NAME’ to the name of your own WordPress database. Also, change “http://oldurl.com” to the URL which you want to change. Change “http://newurl.com” to your new URL.
UPDATE `DATABASE_NAME`.`wp_options` SET `option_value` = replace( option_value, "http://oldurl.com", "http://newurl.com" ) WHERE `wp_options`.`option_name` = 'home'; UPDATE `DATABASE_NAME`.`wp_2_options` SET `option_value` = replace( option_value, "http://oldurl.com", "http://newurl.com" ) WHERE `wp_2_options`.`option_name` = 'home'; UPDATE `DATABASE_NAME`.`wp_3_options` SET `option_value` = replace( option_value, "http://oldurl.com", "http://newurl.com" ) WHERE `wp_3_options`.`option_name` = 'home'; UPDATE `DATABASE_NAME`.`wp_4_options` SET `option_value` = replace( option_value, "http://oldurl.com", "http://newurl.com" ) WHERE `wp_4_options`.`option_name` = 'home'; UPDATE `DATABASE_NAME`.`wp_5_options` SET `option_value` = replace( option_value, "http://oldurl.com", "http://newurl.com" ) WHERE `wp_5_options`.`option_name` = 'home'; UPDATE `DATABASE_NAME`.`wp_6_options` SET `option_value` = replace( option_value, "http://oldurl.com", "http://newurl.com" ) WHERE `wp_6_options`.`option_name` = 'home'; UPDATE `DATABASE_NAME`.`wp_7_options` SET `option_value` = replace( option_value, "http://oldurl.com", "http://newurl.com" ) WHERE `wp_7_options`.`option_name` = 'home'; UPDATE `DATABASE_NAME`.`wp_8_options` SET `option_value` = replace( option_value, "http://oldurl.com", "http://newurl.com" ) WHERE `wp_8_options`.`option_name` = 'home';
Questions and Comments are Welcome