Skip to content

Instantly share code, notes, and snippets.

@seansasso
Created August 27, 2012 21:39
Show Gist options
  • Save seansasso/3492505 to your computer and use it in GitHub Desktop.
Save seansasso/3492505 to your computer and use it in GitHub Desktop.
WordPress DB Domain Search and Replace
# Pulled from http://www.idowebdesign.ca/mysql-replace/
UPDATE wp_comments SET comment_author_url = REPLACE(comment_author_url, 'old-url.com', 'new-url.com');
UPDATE wp_options SET option_value = REPLACE(option_value, 'old-url.com', 'new-url.com');
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, 'old-url.com', 'new-url.com');
UPDATE wp_posts SET post_content = REPLACE(post_content, 'old-url.com', 'new-url.com');
UPDATE wp_posts SET post_excerpt = REPLACE(post_excerpt, 'old-url.com', 'new-url.com');
UPDATE wp_posts SET guid = REPLACE(guid, 'old-url.com', 'new-url.com');
UPDATE wp_usermeta SET meta_value = REPLACE(meta_value, 'old-url.com', 'new-url.com');
UPDATE wp_users SET user_email = REPLACE(user_email, 'old-url.com', 'new-url.com');
UPDATE wp_users SET user_url = REPLACE(user_url, 'old-url.com', 'new-url.com');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment