Skip to content


Advanced usage

VIP-CLI command examples

For demonstration purposes, the <app-alias> value mytestsite and the <env> value develop are used in the VIP-CLI command examples below. Read more about how to target environments in VIP-CLI commands.

Skipping command confirmation

When a command against a production environment is attempted, a prompt will appear in the terminal to confirm the action. To skip this confirmation step pass the --yes (or -y) option before the -- command separator.

vip @mytestsite.develop --yes -- wp option get siteurl

Bypassing the command confirmation is useful when a command is part of a script.

For nested commands run on a production environment, the --yes option is required in both inner and outer commands.

vip @mytestsite.develop --yes -- wp post delete $(vip @mytestsite.develop --yes -- wp post list --post_type='page' --format=ids)

Writing command output to a file

All WP-CLI commands are run on a remote web server. File operations initiated by a command will occur on the remote server as well with no way to retrieve the file.

It is recommended to write the output to the console first using helpers like WP_CLI::line() and WP_CLI::log(), then redirecting the output to a specific file:

vip @mytestsite.develop --yes -- wp option get siteurl > output.txt

See more detailed guidance on saving command output to a file.

Referencing a file input

To reference an input file in a command, commit the file to a publicly accessible location within the application’s GitHub repository, like the themes or plugins directories. The path of the file can then be referenced with a path similar to this example:


VIP-CLI can be used for automating common flows and tasks both locally and in CI contexts (e.g. triggering Data Sync on a schedule; running WP-CLI commands across all environments). To do this, the authentication prompt can be bypassed by creating a config file.

  1. Generate a new token in the VIP Dashboard (select “Set up CLI“).
  2. Create a file named ~/.config/configstore/vip-go-cli.json.
  3. Add the following code to vip-go-cli.json, replacing VIP-USER-TOKEN with the token retrieved from the VIP Dashboard.
  "vip-go-cli": "{VIP-USER-TOKEN}"

When setting up automation for VIP-CLI commands, it is recommended to create a bot/machine user and generating a token for that machine user account.

Nested commands

When running more complex WP-CLI commands such as loops or nested commands, each reference to wp must use its own remote execution pattern.

In the examples below, a nested command is structured to include two WP-CLI commands with the following functions:

  1. wp post list to retrieve a list of post IDs
  2. wp post delete to delete the retrieved post IDs

This will not work:

The format of this nested command example will not work as intended because the command inside the $() is referencing the local version of wp (i.e. on the local computer):

$ vip @mytestsite.develop -- wp post delete $(wp post list --post_type='page' --format=ids)
-bash: xyz: command not found

Running the command in the above format might only return a message indicating  wp does not exist locally. However, if the command is run from within a local WordPress site directory, it may have a more destructive outcome by retrieving post IDs from the local WordPress site and passing those IDs to the delete command to be run against the remote site.

This will work:

vip @mytestsite.preprod -- wp post delete $(vip @mytestsite.preprod -- wp post list --post_type='page' --format=ids)

Each WP-CLI command must be run as its own VIP-CLI command. In addition, for production environments, the --yes flag must be included in both the inner and outer commands to bypass the confirmation prompts:

vip @mytestsite.develop --yes -- wp post delete $(vip @mytestsite.develop --yes -- wp post list --post_type='page' --format=ids)


Because of the way that shell utilities handle stdin, commands like xargs may not work with WP-CLI output as expected. In these cases it might be easier to write the commands to a file and then execute that file.

This will not work:

vip @mytestsite.develop -- wp post list --fields=ID --format=csv --posts_per_page=5 | xargs -I % 'vip @mytestsite.develop -- wp post update % --post_category=NewCategory '

This will work:

$ vip @mytestsite.develop -- wp post list --fields=ID --format=csv --posts_per_page=5 | xargs -I % sh -c 'echo "vip @mytestsite.develop -- wp post update % --post_category=NewCategory" >> '
$ chmod +x
$ ./ 

System proxy support

A system proxy variable may be set in a local machine’s profile, such as:


By default, VIP-CLI does not use the system proxies set in a local machine’s profile. Passing VIP-CLI commands with theVIP_USE_SYSTEM_PROXY variable set to 1 will override this default behavior and honor the the local machine’s profile settings.

The VIP_USE_SYSTEM_PROXY system proxy variable can be set per command:

VIP_USE_SYSTEM_PROXY=1 vip [command]

Or set in the profile used most often in the local machine’s terminal application.
For example: 


Last updated: August 08, 2022