-
·
Quick Start
Congratulations! You’ve installed WP-CLI for the first time, and are ready to level-up your use of WordPress. This page contains a brief introduction to WP-CLI with some example usage. Introduction WP-CLI is a command line interface for WordPress. The project’s goal is to offer a complete alternative to the WordPress admin; for any action you…
-
·
WP_CLI::add_wp_hook()
Add a callback to a WordPress action or filter. Usage WP_CLI::add_wp_hook( $tag, $function_to_add, $priority = 10, $accepted_args = 1 ) $tag (string) Named WordPress action or filter. $function_to_add (callable) Callable to execute when the action or filter is evaluated. $priority (integer) Priority to add the callback as. $accepted_args (integer) Number of arguments to pass to…
-
·
WP_CLI::colorize()
Colorize a string for output. Usage WP_CLI::colorize( $string ) $string (string) String to colorize for output, with color tokens. @return (string) string. Notes Yes, you can change the color of command line text too. For instance, here’s how WP_CLI::success() colorizes “Success: ” WP_CLI::colorize( “%GSuccess:%n ” ) Uses \cli\Colors::colorize() to transform color tokens to display settings.…
-
·
WP_CLI::confirm()
Ask for confirmation before running a destructive operation. Usage WP_CLI::confirm( $question, $assoc_args = [] ) $question (string) Question to display before the prompt. $assoc_args (array) Skips prompt if ‘yes’ is provided. Notes If ‘y’ is provided to the question, the script execution continues. If ‘n’ or any other response is provided to the question, script…
-
·
WP_CLI::debug()
Display debug message prefixed with “Debug: ” when –debug is used. Usage WP_CLI::debug( $message, $group = false ) $message (string|WP_Error|Exception|Throwable) Message to write to STDERR. $group (string|bool) Organize debug message to a specific group.Use `false` to not group the message. @return (void) Notes Debug message is written to STDERR, and includes script execution time. Helpful…
-
·
Troubleshooting Guide
Before you start to report a new issue on the GitHub repository, make sure to check your local installation, as some settings may typically result in an unexpected outcome of your WP-CLI commands. How do I get more verbose informations about my WP-CLI installation? WP-CLI offers the command wp –info, which provides you with a…
-
·
Sharing WP-CLI Packages
By default, WP-CLI places installed packages in ~/.wp-cli/packages/, a hidden subdirectory for the user’s home directory. Because the home directory is different for each user, this naturally means each system user will have a separate directory of installed packages. If you have multiple active shell users on a server, and want to share installed WP-CLI…
-
·
Roadmap
WP-CLI is released every 3-4 months, typically around the beta period of WordPress’s release cycle: Current: v2.12.0 (May 7th, 2025) Patch versions are released on an as-needed basis, usually to address bugs or regressions. The current version of WP-CLI is the only officially supported version. The current longer-term goals of the project are: Improve contributor…
-
·
Shell Friends
As you advance upon your use of WP-CLI, you’ll find that a little bit of command line knowledge can have a huge impact on your workflow. Here are some of our favorite shell helper utilities. You Should Know Search through your bash history Did you know that every command you run on your shell is…
-
·
Repository Management
Package Names Package names for the official wp-cli GitHub organization need to be discussed upfront with the maintainers. Before creating a new repository, it’s important to discuss the repository first. This discussion helps establish consensus on what purpose the codebase serves, and where it lives best in the WP-CLI ecosystem. Package names for WP-CLI commands…