One incredibly annoying aspect of Wordpress is that the site root URL is set in the database.
Normally, I would
- create a local site
- commit to git
- push the code to the repo
- pull down to the server
The site config should be in code and the content in the database, but in Wordpress it's mixed pele-mele, so you can't maintain a simple workflow, because every time you pull your live data down, your site breaks. If you forget and push your dev data up, your site breaks.
The solution is simple:
- make sure your wp-config.php is in your .gitignore so it's not tracked by version control. That means you can have a different one on your dev and live servers
- in your wp-config.php file, add two lines to override whatever the siteurl and home page urls are in the DB
- now you can develop locally and push to your test and live platforms normally without borking your site and without having to manually edit your database every time you pull down your live data.