michael.mcghee of Papercut Interactive
3/22/2019 - 2:29 PM

Wordpress Site Address changes post go live

After you move a site's database from beta to the production URL you'll need to change the site url in several places. These SQL statements allow you to do so quickly within PHPMyAdmin or any other place you can run SQL statements.

More info: https://wpbeaches.com/updating-wordpress-mysql-database-after-moving-to-a-new-url/

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

UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl.com','http://www.newurl.com');

UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl.com', 'http://www.newurl.com');

UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl.com','http://www.newurl.com');