Last active
December 10, 2019 10:55
-
-
Save 19h47/1779d836bbf1b0c1a54e5e1f9550eca9 to your computer and use it in GitHub Desktop.
SQL queries to change domain name on a WordPress 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
# see https://sql.sh/988-requetes-migrer-wordpress | |
# Change the URL of the site | |
UPDATE wp_options | |
SET option_value = replace(option_value, 'http://localhost:8888/site', 'http://www.site.fr') | |
WHERE option_name = 'home' | |
OR option_name = 'siteurl'; | |
# Change GUID URL | |
UPDATE wp_posts | |
SET guid = REPLACE (guid, 'http://localhost:8888/site', 'http://www.site.fr'); | |
# Change media URL in posts and pages | |
UPDATE wp_posts | |
SET post_content = REPLACE (post_content, 'http://localhost:8888/site', 'http://www.site.fr'); | |
# Change metadata URL | |
UPDATE wp_postmeta | |
SET meta_value = REPLACE (meta_value, 'http://localhost:8888/site','http://www.site.fr'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment