Skip to content

Instantly share code, notes, and snippets.

@akozlik
Created April 20, 2015 18:50
Show Gist options
  • Save akozlik/f6b82cd2779a3fbe7c72 to your computer and use it in GitHub Desktop.
Save akozlik/f6b82cd2779a3fbe7c72 to your computer and use it in GitHub Desktop.
Wordpress Search and Replace
// NOTE: All URLs must contain their protocol and must NOT have trailing slashes
// Set the path for all JS / CSS / template imports
update wp_options set option_value = 'new_domain' where option_id in (1, 2)
// Update all links
UPDATE wp_posts SET guid = replace(guid, 'old_url','new_url');
// Replace URL references in post content
UPDATE wp_posts SET post_content = replace(post_content, 'old_url', 'new_url');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment