Skip to content

Instantly share code, notes, and snippets.

@bohman
Created January 16, 2013 16:04
Show Gist options
  • Save bohman/4548309 to your computer and use it in GitHub Desktop.
Save bohman/4548309 to your computer and use it in GitHub Desktop.
Simple query to update URLs in a WP install. Useful when moving a site. Wrote it a long time ago, lost it when my computer got stolen, was frustrated, decided to store it here.
SET @oldurl = 'dev1.nollfyranoll.se';
SET @newurl = 'pilgrimsvagen.se';
UPDATE wp_posts SET POST_CONTENT = replace(POST_CONTENT, @oldurl, @newurl);
UPDATE wp_posts SET GUID = replace(GUID, @oldurl, @newurl);
UPDATE wp_options SET OPTION_VALUE = replace(OPTION_VALUE, @oldurl, @newurl);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment