Whenever I create a new website I first create a staging site on a subdomain like “stage.domain-name.com”.
After everything works correctly I export the database, open it in notepad++ and do a find/replace for “subdomain.domain-name.com” and replace it with “domain-name.com”… finally I import it into a new database for the live site.
My question is… what SQL query would I need to run if I just wanted to do this simple find/replace on the entire database using phpmyadmin?
-CH
The table where your URL is saved is wp_options. You should do an update on the columns that use the URL for your site:
UPDATE TABLE wp_options SET option_value = "new domain" WHERE option_name = "siteurl"
UPDATE TABLE wp_options SET option_value = "new domain" WHERE option_name = "home"
I might be missing some value, but whenever you do this find/replace process again, you can notice the values and tables that should be updated and add them to this script.
WordPress Codex has a nice guide on how to change a site URL, maybe that’s even handier for you: Changing the Site URL