Skip to content

Instantly share code, notes, and snippets.

@luisabarca
Created December 23, 2013 17:18
Show Gist options
  • Save luisabarca/8100933 to your computer and use it in GitHub Desktop.
Save luisabarca/8100933 to your computer and use it in GitHub Desktop.
Migrating WordPress to a new domain. (Ex. Migrate Wordpress from dev to a production server)
# Update WordPress home and url
UPDATE wp_options SET option_value = replace(option_value, 'beta.mydoamin.com', 'mydomain.com') WHERE option_name = 'home' OR option_name = 'siteurl';
# Update URL's of every entry (post, page, custom post type)
UPDATE wp_posts SET guid = replace(guid, 'beta.mydomain.com', 'mydomain.com');
# Update post content
UPDATE wp_posts SET post_content = replace(post_content, 'beta.mydomain.com', 'mydomain.com');
# Update menus
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'beta.mydoamin.com', 'mydomain.com') WHERE meta_value LIKE '%beta.mydomain.com%' AND meta_key = '_menu_item_url'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment