Created
November 4, 2025 13:34
-
-
Save lurepheonix/ef61ed1a5cb778ebc0391ee96e73545a to your computer and use it in GitHub Desktop.
Change hostname of a Wordpress site
This file contains hidden or 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_url = 'oldurl.com'; | |
| SET @new_url = 'newurl.com'; | |
| UPDATE wp_options | |
| SET option_value = REPLACE(option_value, @old_url, @new_url) | |
| WHERE option_name IN ('home', 'siteurl'); | |
| UPDATE wp_posts | |
| SET guid = REPLACE(guid, @old_url, @new_url); | |
| UPDATE wp_posts | |
| SET post_content = REPLACE(post_content, @old_url, @new_url); | |
| UPDATE wp_postmeta | |
| SET meta_value = REPLACE(meta_value, @old_url, @new_url); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment