Last active
January 6, 2016 23:17
-
-
Save FernE97/8139535 to your computer and use it in GitHub Desktop.
Useful for changing over WordPress urls
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
-- Avoid updating serialized strings with "NOT LIKE '%{%'" | |
UPDATE wp_options SET option_value = REPLACE(option_value, '//olddomain.com', '//newdomain.com') WHERE option_value NOT LIKE '%{%'; | |
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, '//olddomain.com', '//newdomain.com') WHERE meta_value NOT LIKE '%{%'; | |
UPDATE wp_posts SET post_content = REPLACE(post_content, '//olddomain.com', '//newdomain.com') WHERE post_content NOT LIKE '%{%'; | |
UPDATE wp_posts SET guid = REPLACE(guid, '//olddomain.com', '//newdomain.com') WHERE post_type = 'attachment'; | |
-- File paths | |
UPDATE wp_options SET option_value = REPLACE(option_value, '/home/old/path', '/home/new/path') WHERE option_value NOT LIKE '%{%'; | |
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, '/home/old/path', '/home/new/path') WHERE meta_value NOT LIKE '%{%'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment