Last active
January 14, 2016 05:59
-
-
Save CaroManel/1478c129d55df54289c4 to your computer and use it in GitHub Desktop.
Change url in wordpress when migrating a site
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 @old := 'http://oldsite.carol.local'; | |
SET @chunk_old := '%oldsite.carol%'; | |
SET @new := 'http://mynewsite.carol.local'; | |
UPDATE wp_options SET option_value = replace(option_value, @old, @new); | |
UPDATE wp_posts SET guid = replace(guid, @old, @new); | |
UPDATE wp_posts SET post_content = replace(post_content, @old, @new); | |
UPDATE wp_postmeta SET meta_value = replace(meta_value,@old, @new); | |
/* It is always good to check if there is any other portings of url pointing to the old site */ | |
select option_value from wp_options where option_value like @chunk_old; | |
select guid from wp_posts where guid like @chunk_old; | |
select post_content from wp_posts where post_content like @chunk_old; | |
select meta_value from wp_postmeta where meta_value like @chunk_old; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment