How to change your domain name in WordPress

By | August 25, 2017

Changing your domain name in WordPress should be an easy task, but for some reason it’s not. All of the site’s assets are and links are hardcoded in the database to the old domain name.

You can easily update the domain name by running a few SQL scripts (I recommend making a backup of your database before doing this) –

UPDATE wp_options SET option_value = replace(option_value, 'http://olddomain.com', 'http://newdomain.com') WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE wp_posts SET guid = replace(guid, 'http://olddomain.com','http://newdomain.com');

UPDATE wp_posts SET post_content = replace(post_content, 'http://olddomain.com', 'http://newdomain.com');

UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://olddomain.com', 'http://newdomain.com');

While you’re at it, change your new domain to use https (it has several advantages).


If you have a WordPress site and are looking for help (in St. Louis or not), you canĀ contact me.

Leave a Reply

Your email address will not be published. Required fields are marked *