Skip to content

Instantly share code, notes, and snippets.

@shansana
Last active April 5, 2017 05:18
Show Gist options
  • Save shansana/357c5feb532e2b2e556de1ec5d730fd2 to your computer and use it in GitHub Desktop.
Save shansana/357c5feb532e2b2e556de1ec5d730fd2 to your computer and use it in GitHub Desktop.
Wordpress Site URL update when changing the host
-- Replace http://oldurlhere with your old site url
-- Replace http://newurlhere with your new site url
-- Run the Query
UPDATE wp_options SET option_value = replace(option_value, 'http://oldurlhere', 'http://newurlhere') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://oldurlhere','http://newurlhere');
UPDATE wp_posts SET post_content = replace(post_content, 'http://oldurlhere', 'http://newurlhere');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://oldurlhere','http://newurlhere');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment