Created
November 26, 2014 15:46
-
-
Save pat-eason/d2d91d16b026759fccab to your computer and use it in GitHub Desktop.
WordPress SQL update
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#set variables | |
SET @oldurl = 'http://oldurl.com'; | |
SET @newurl = 'http://newurl.com'; | |
#update wp_site options | |
UPDATE wp_options SET option_value = replace(option_value, @oldurl, @newurl) WHERE option_name = 'home' OR option_name = 'siteurl'; | |
#update wp_posts guid | |
UPDATE wp_posts SET guid = REPLACE (guid, @oldurl, @newurl); | |
#update wp_posts content | |
UPDATE wp_posts SET post_content = REPLACE (post_content, @oldurl, @newurl); | |
#update wp_postmeta | |
UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, @oldurl, @newurl); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment