Skip to content

Instantly share code, notes, and snippets.

@19h47
Last active December 10, 2019 10:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 19h47/1779d836bbf1b0c1a54e5e1f9550eca9 to your computer and use it in GitHub Desktop.
Save 19h47/1779d836bbf1b0c1a54e5e1f9550eca9 to your computer and use it in GitHub Desktop.
SQL queries to change domain name on a WordPress site
# 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