Skip to content

Latest commit

 

History

History
92 lines (70 loc) · 2.45 KB

README.md

File metadata and controls

92 lines (70 loc) · 2.45 KB

WPE CLI

Provides wp-cli access to your remote WP Engine installs

Usage

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.

Installation

Option 1: Install this as a wp-cli package

  1. Install any wp-cli package (if you haven't already done so) Ex: wp package install anhskohbo/wp-cli-themecheck
  2. Edit ~/.wp-cli/packages/composer.json
  3. Add the ryanshoover/wpe-cli repo as a requirement
  4. Run ~/.wp-cli/packages/composer update
  5. 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"
        }
    },

Option 2: Install this as a plugin

  1. Clone the repo into your plugins folder git clone [email protected]:ryanshoover/wpe-cli.git ./wp-content/plugins/wpe-cli
  2. Enable the plugin
  3. Use the CLI commands from just this WordPress install.

Configure the authentication settings

  1. Open up the "advanced" tab in WP Engine Portal
  2. Open the Network Inspector
  3. Run a command in the wp-cli window
  4. Look at the request that went out to https://my.wpengine.com/installs
  5. From the request, get
    • The value for the Header X-CSRF-Token
  • The value for the Cookie __ar_v4
    • The value for the Cookie _session_id
  1. Add these values to your config file in the format below
  2. Done!
# Settings for the wpe-cli integration
wpe-cli:
  token: ABCDEFGHIJKLMNOP
  ar_v4: QRSTUVWYZ1234567890
  session_id: abcdefghijklmnop

Pro tip

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