What’s the quickest way to clone a WP VIP site to your local VIP dev environment?
Considering you already have a codebase and app up and running locally, and you need to sync data with with the production site, here are the steps:
- Instead of manually downloading and importing the database, doing search-replace, dealing with the multi-site databases complexity, simply use this command to automatically sync the local database with the remote one:
vip @example-site.production dev-env sync sql --slug=example-site-local
Magic part here is the VIP’s CLIsync
command. Not sure if it existed before, or I was not aware of it, but since I recently learned about it, it made my life much easier. - Now, in the WP VIP Dashboard, go to Media → Backups, generate a backup, and download it. Then run the media import command:
vip dev-env import media --slug=
example-site-local
/Users/example-user/Downloads/wp-content/uploads
Don’t forget to adjust the path of the downloaded uploads folder. - You may need to re-create
vipgo
user, so you can login without 2fa blocking you. You can do that with this command:vip
dev-env
--slug=example-site-local
exec -- wp user create vipgo vipgo@local.com --user_pass=password - Set vipgo user superadmin:
vip dev-env --slug=example-site-local exec -- wp super-admin add vipgo
- Flush cache after import:
vip dev-env --slug=example-site-local exec -- wp cache flush
- If needed, deactivate Jetpack account protection locally, to prevent it from blocking you to login:
vip dev-env --slug=example-site-local exec -- wp jetpack module deactivate account-protection
And there you go. You local env should now look and work exactly as the production site.