WP-CLI’s behavior can be changed at runtime through the use of environment variables.
To set an environment variable on demand, simply place the environment variable definition before the WP-CLI command you mean to run.
# Use vim to edit a post $ EDITOR=vim wp post edit 1
To set the same environment variable value for every shell session, you’ll need to include the environment variable definition in your
# Always use vim to edit a post export EDITOR=vim
List of Environment variables
- Directory to store the WP-CLI file cache.
- Path to the global
- Allows the user to override the default
- Disable WP-CLI automatic checks for updates.
- Directory to store packages installed through WP-CLI’s package management.
- PHP binary path to use when overriding the system default (only works for non-Phar installation).
- Arguments to pass to the PHP binary when invoking WP-CLI (only works for non-Phar installation).
- When using
--ssh=<ssh>, perform a command before WP-CLI calls WP-CLI on the remote server.
- Avoid ambiguity by telling WP-CLI to treat any arguments before the command as global, and after the command as local.
- Set to
trueto skip showing the global parameters at the end of the help screen. This saves screen estate for advanced users.