Skip to content

Instantly share code, notes, and snippets.

@phsacramento
Created April 16, 2014 14:58
Show Gist options
  • Save phsacramento/10889572 to your computer and use it in GitHub Desktop.
Save phsacramento/10889572 to your computer and use it in GitHub Desktop.
SET @antigaURL = 'http://siteantigo.com';
SET @novaURl = 'http://sitenovo.com';
# Atualiza URL do site nas opções
UPDATE wp_options SET option_value = replace(option_value, @antigaURL, @novaURL);
# Atualiza URL dos posts (e dentro deles)
UPDATE wp_posts SET guid = REPLACE (guid, @antigaURL, @novaURL);
UPDATE wp_posts SET post_content = REPLACE (post_content, @antigaURL, @novaURL);
UPDATE wp_posts SET post_excerpt = REPLACE (post_excerpt, @antigaURL, @novaURL);
# Atualiza URLs de metas dos posts
UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, @antigaURL, @novaURL);
# Atualiza URLs de comentários
UPDATE wp_comments SET comment_author_url = REPLACE (comment_author_url, @antigaURL, @novaURL);
# Atualiza URLs dos Links
UPDATE wp_links SET link_url = REPLACE (link_url, @antigaURL, @novaURL);
# Atualiza URLs dos usuário
UPDATE wp_users SET user_url = REPLACE (user_url, @antigaURL, @novaURL);
# Atualiza URLs de metas dos usuarios
UPDATE wp_usermeta SET meta_value = REPLACE (meta_value, @antigaURL, @novaURL);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment