If you develop WordPress sites for clients, you’ve probably run into this problem. You’re developing theme code locally, while the client is entering content on a staging site. You need to have real content in order to satisfy a lot of the conditions that your code will experience when deployed.
So you want to have their content in your local environment frequently, but there are challenges like translating domain names and remembering SQL statements and it’s generally no fun.
So, I wrote this script to satisfy a simple need – to take a .sql dump I created from the staging environment and import it into my local database, while translating the staging hostname to my local development hostname on-the-fly. That’s it! That’s all it does. but it does it easily – you just pull the .sql and type “dbup.” If you have any questions or suggestions, create an Issue or better yet – fork it and submit a Pull Request.
I hope this helps!
Check it out on github – https://github.com/mikesusz/migrate-wordpress-database