Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save doxt3r/7d209faaa0fa8d43f8fd2ee36a82072c to your computer and use it in GitHub Desktop.

Select an option

Save doxt3r/7d209faaa0fa8d43f8fd2ee36a82072c to your computer and use it in GitHub Desktop.
Use this SQL script when changing domains on a WordPress site. Whether you’re moving from an old domain to a new domain or you’re changing from a development domain to a production domain this will work. __STEP1: always backup your database. __STEP2: change the ‘oldsite.com’ and ‘newsite.com’ variables to your own. __STEP3: make sure your databa…
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 post_content = replace(post_content, 'http://olddomain.com', 'http://newdomain.com');
UPDATE wp_links SET link_url = replace(link_url, 'http://olddomain.com','http://newdomain.com');
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://olddomain.com','http://newdomain.com');
UPDATE wp_posts SET guid = replace(guid, 'http://olddomain.com','http://newdomain.com');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment