Skip to content

Instantly share code, notes, and snippets.

@pedrovasconcellos
Created September 30, 2018 06:00
Show Gist options
  • Save pedrovasconcellos/422b194f98401b1a9d252b9db291bbfc to your computer and use it in GitHub Desktop.
Save pedrovasconcellos/422b194f98401b1a9d252b9db291bbfc to your computer and use it in GitHub Desktop.
MySQL Wordpress Migration Script
UPDATE wp_options
SET option_value = REPLACE(option_value, 'http://EnderecoAntigo.com', 'http://EnderecoNovo.com')
WHERE option_name = 'home'
OR option_name = 'siteurl';
UPDATE wp_posts
SET guid = REPLACE (guid, 'http://EnderecoAntigo.com', 'http://EnderecoNovo.com');
UPDATE wp_posts
SET post_content = REPLACE (post_content, 'http://EnderecoAntigo.com', 'http://EnderecoNovo.com');
UPDATE wp_postmeta
SET meta_value = REPLACE (meta_value, 'http://EnderecoAntigo.com', 'http://EnderecoNovo.com');
UPDATE wp_posts
SET guid = REPLACE (guid,'http://EnderecoAntigo.com', 'http://EnderecoNovo.com')
WHERE post_type = 'attachment';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment