WP VIP: Clone a site to a local WP VIP environment easy

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:

  1. 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 CLI sync 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.

  2. 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.

  3. 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

  4. Set vipgo user superadmin:

    vip dev-env --slug=example-site-local exec -- wp super-admin add vipgo

  5. Flush cache after import:

    vip dev-env --slug=example-site-local exec -- wp cache flush

  6. 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.

Table of Contents