Using WP-CLI at the command line. WP-CLI has many commands, and the rest of this article is only an introduction to its capabilities. However, to view WP-CLI's online help at any time, type the following command: wp help. Alternatively, to view the online help for a specific WP.
The WP-CLI is a tool that enables you to interact with your WordPress site directly by using commands in a text-based interface. It’s also very comprehensive, featuring a wide variety of potential commands. Almost anything you can do on the back end of your site, you can do much faster using the WP-CLI. WP-CLI is the official command line interface for WordPress. You can install and update WordPress core, manage plugins and themes, and much more. For example, this is how you install and activate the Akismet plugin: wp plugin install akismet -activate.
WP-CLI is the official command-line interface for WordPress. It enables you to perform myriad WordPress development tasks, such as updating plugins, configuring multisite installations, etc., from within the command line, without using a web browser. WordPress has a great GUI-based installation process however some use cases call for CLI! Or, maybe you just feel more at home in a terminal, either way this article will show you how to get your WordPress site setup with just a terminal, using WP-CLI, and maybe a sprinkle of SSH.
Executes arbitrary PHP code.
Note: because code is executed within a method, global variables need to be explicitly globalized.
OPTIONS OPTIONS
Wordpress Click Counter
- <php-code>
- The code to execute, as a string.
- [--skip-wordpress]
- Execute code without loading WordPress.
EXAMPLES EXAMPLES
GLOBAL PARAMETERS GLOBAL PARAMETERS
Wordpress Client
These global parameters have the same behavior across all commands and affect how WP-CLI interacts with WordPress.
Argument | Description |
---|---|
--path=<path> | Path to the WordPress files. |
--url=<url> | Pretend request came from given URL. In multisite, this argument is how the target site is specified. |
--ssh=[<scheme>:][<user>@]<host|container>[:<port>][<path>] | Perform operation against a remote server over SSH (or a container using scheme of “docker”, “docker-compose”, “vagrant”). |
--http=<http> | Perform operation against a remote WordPress installation over HTTP. |
--user=<id|login|email> | Set the WordPress user. |
--skip-plugins[=<plugins>] | Skip loading all plugins, or a comma-separated list of plugins. Note: mu-plugins are still loaded. |
--skip-themes[=<themes>] | Skip loading all themes, or a comma-separated list of themes. |
--skip-packages | Skip loading all installed packages. |
--require=<path> | Load PHP file before running the command (may be used more than once). |
--[no-]color | Whether to colorize the output. |
--debug[=<group>] | Show all PHP errors and add verbosity to WP-CLI output. Built-in groups include: bootstrap, commandfactory, and help. |
--prompt[=<assoc>] | Prompt the user to enter values for all command arguments, or a subset specified as comma-separated values. |
--quiet | Suppress informational messages. |
Command documentation is regenerated at every release. To add or update an example, please submit a pull request against the corresponding part of the codebase.