Skip to content

Instantly share code, notes, and snippets.

@hullen
Created February 15, 2013 01:55
Show Gist options
  • Save hullen/4958058 to your computer and use it in GitHub Desktop.
Save hullen/4958058 to your computer and use it in GitHub Desktop.
Wordpress SQL Update for alter the URL changes when you publish your site. This SQL helps you to speed up update yours url values in tables of the database. Just replace your old url by your new url of the site. Code helped by my friend @akbortoli
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldsite.com', 'http://www.newsite.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = REPLACE (guid, 'http://www.oldsite.com.br', 'http://www.newsite.com');
UPDATE wp_posts SET post_content = REPLACE (post_content, 'http://www.oldsite.com', 'http://www.newsite.com');
UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, 'http://www.oldsite.com','http://www.newsite.com');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment