Last active
February 15, 2022 06:37
-
-
Save thetwopct/187b108d102afbc44a7b6c47f30617fb to your computer and use it in GitHub Desktop.
wp-env Cheat Sheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# start from your package.json | |
npm run wp-env start | |
# default address | |
http://localhost:8888 | |
# default credentials | |
username: admin | |
password: password | |
# changing port | |
WP_ENV_PORT=3000 | |
# stop the container | |
npm run wp-env stop | |
# stop and start | |
npm run wp-env stop && npm run wp-env start | |
# clean | |
npm run wp-env clean all | |
# clean and start again | |
npm run wp-env clean all && npm run wp-env start | |
# wp-cli commands | |
npm run wp-env run cli wp user list | |
npm run wp-env run cli wp | |
npm run wp-env run cli "wp theme activate storefront" | |
npm run wp-env run cli wp db export db.sql # warning - this export disappears in to thin air | |
npm run wp-env run cli wp db export ./backups/test.sql #working based on mappings below | |
# mapping a local directory in .wp-env.json | |
"mappings": { | |
"/backups": "./backups" | |
} | |
# importing a db backup from this directory | |
npm run wp-env run cli wp db import ./backups/storefront-clean.sql | |
# update urls | |
npm run wp-env run cli wp search-replace https://woo-tax-environment.lndo.site http://localhost:8888 | |
# access the db | |
docker ps | |
# find the mysql port, i.e. 57825 | |
# connect to localhost and the port | |
username: root | |
password: password | |
database: wordpress | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment