change primary domain name in wordpress

sometimes it may be necessary to change the domain name of your wordpress blog. Instead of reinstalling wordpress, we can modify the current database to accomodate the changes. run the following query:

Back up your db. then


use wordpress_db;

update wp_site set domain='newdomain.com';

update wp_blogs set domain='newdomain.com';

update wp_options SET option_value = 'http://newdomain.com' WHERE wp_options.option_id =1;

update wp_options SET option_value = 'http://newdomain.com/wp-content/uploads' WHERE wp_options.option_id =17;

update wp_options SET option_value = 'http://newdomain.com' WHERE wp_options.option_id =46;

Author: bpeh

Bernard Peh is a great passioner of web technologies and one of the co-founder of Sitecritic.net Website Design and Reviews. He works with experienced web designers and developers everyday, developing and designing commercial websites. He specialises mainly in SEO and PHP programming.