Skip to content

Instantly share code, notes, and snippets.

@kane-c
Last active August 29, 2015 14:04
Show Gist options
  • Save kane-c/55fe45008ff6ebe2fa2e to your computer and use it in GitHub Desktop.
Save kane-c/55fe45008ff6ebe2fa2e to your computer and use it in GitHub Desktop.
The SQL required for changing a WordPress install's domain
-- Replace new-domain and old-domain as with your values
SET @old_domain = '',
@new_domain = '';
UPDATE `wp_options`
SET `option_value` = REPLACE (
`option_value`,
@old_domain,
@new_domain
);
UPDATE `wp_posts`
SET `post_content` = REPLACE (
`post_content`,
@old_domain,
@new_domain
),
`guid` = REPLACE (
`guid`,
@old_domain,
@new_domain
);
UPDATE `wp_postmeta`
SET `meta_value` = REPLACE (
`meta_value`,
@old_domain,
@new_domain
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment