A command line interface for WordPress

WP-CLI has a series of global parameters which work with all commands. They can be specified either as flags for the wp executable in the terminal, or defined in a YAML config file.

The order of precedence, from highest priority to lowest, is:

  1. Command-line flags
  2. wp-cli.local.yml file inside the current working directory (or upwards)
  3. wp-cli.yml file inside the current working directory (or upwards)
  4. ~/.wp-cli/config.yml file (path can be changed by setting the WP_CLI_CONFIG_PATH environment variable)
  5. Defaults

The table below lists the available options (specified in the configuration file) and flags (specified on the command-line).

Description Option Flag
Path to the WordPress files.
Default value: null
path: <path> --path=<path>
Pretend request came from given URL. In multisite, this argument is how the target site is specified.
Default value: null
url: <url> --url=<url>
Set the WordPress user.
Default value: null
user: <id|login|email> --user=<id|login|email>
Skip loading all or some plugins. Note: mu-plugins are still loaded.
Default value: ""
skip-plugins: <list> --skip-plugins[=<plugin>]
Skip loading all or some themes.
Default value: ""
skip-themes: <list> --skip-themes[=<theme>]
Skip loading all installed packages.
Default value: false
skip-packages: <bool> --skip-packages
Load PHP file before running the command (may be used more than once).
Default value: []
require: <path> --require=<path>
(Sub)commands to disable.
Default value: []
disabled_commands: <list>
Whether to colorize the output.
Default value: "auto"
color: <bool> --[no-]color
Show all PHP errors; add verbosity to WP-CLI bootstrap.
Default value: false
debug: <bool> --debug
Prompt the user to enter values for all command arguments.
Default value: false
Suppress informational messages.
Default value: false
quiet: <bool> --quiet
List of Apache Modules that are to be reported as loaded.
Default value: []
apache_modules: <list>

Besides the global parameters described above, config files can also contain defaults for any subcommand.

Example wp-cli.yml file:

path: wp-core
url: http://example.com
user: admin
color: false
  - db drop
  - plugin install
  - path-to/command.php

core config:
	dbuser: root
	extra-php: |
		define( 'WP_DEBUG', true );
		define( 'WP_POST_REVISIONS', 50 );