Provides wp-cli access to your remote WP Engine installs
Run wp-cli commands on your WP Engine install from your local environment
$ wp wpe cli myinstall core version
4.7.3
Clear all of the caches on your WP Engine production install
$ wp wpe flush myinstall
Success: Cache flushed!
Trigger a backup checkpoint on your WP Engine install
$ wp wpe backup myinstall
Success: Backup triggered! This can take a while! You will be notified at [email protected] when the checkpoint has completed.
Replace your local database with a fresh copy of a WP Engine install's database
$ wp wpe fetch-db myinstall
Success: Local database replaced with database from myinstall.
- Install any wp-cli package (if you haven't already done so)
Ex:
wp package install anhskohbo/wp-cli-themecheck
- Edit
~/.wp-cli/packages/composer.json
- Add the
ryanshoover/wpe-cli
repo as a requirement - Run
~/.wp-cli/packages/composer update
- Use the CLI commands from any WordPress install on your local machine
"require": {
"ryanshoover/wpe-cli": "dev-master",
},
"repositories": {
"ryanshoover/wpe-cli": {
"type": "vcs",
"url": "https://github.com/ryanshoover/wpe-cli"
}
},
- Clone the repo into your plugins folder
git clone [email protected]:ryanshoover/wpe-cli.git ./wp-content/plugins/wpe-cli
- Enable the plugin
- Use the CLI commands from just this WordPress install.
- Open up the "advanced" tab in WP Engine Portal
- Open the Network Inspector
- Run a command in the wp-cli window
- Look at the request that went out to
https://my.wpengine.com/installs
- From the request, get
- The value for the Header
X-CSRF-Token
- The value for the Header
- The value for the Cookie
__ar_v4
- The value for the Cookie
_session_id
- The value for the Cookie
- Add these values to your config file in the format below
- Done!
# Settings for the wpe-cli integration
wpe-cli:
token: ABCDEFGHIJKLMNOP
ar_v4: QRSTUVWYZ1234567890
session_id: abcdefghijklmnop
You can shorten $ wp wpe ...
to just $ wpe ...
. Just add this line to your ~/.bash_profile
or ~/.bashrc
and restart your shell window.
alias wpe='wp wpe' # shortcut alias for wpe-cli tool