Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
WP-CLI Get Production DB
#get siteurl option from prod and dev
PROD_SITEURL=$(wp @prod option get siteurl);
DEV_SITEURL=$(wp @dev option get siteurl);
#Export database from prod and import to dev
wp @prod db export - > prod.sql
wp @dev db import /srv/www/edmund/prod.sql
#Update siteurl
wp @dev search-replace $PROD_SITEURL $DEV_SITEURL
#Remove .sql file
rm prod.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.