WP_CLI::launch_self() Edit

Run a WP-CLIWP-CLI WP-CLI is the Command Line Interface for WordPress, used to do administrative and development tasks in a programmatic way. The project page is http://wp-cli.org/ https://make.wordpress.org/cli/ command in a new process reusing the current runtime arguments.


WP_CLI::launch_self( $command, $args = [], $assoc_args = [], $exit_on_error = true, $return_detailed = false, $runtime_args = [] )
$command (string) WP-CLI command to call.
$args (array) Positional arguments to include when calling the command.
$assoc_args (array) Associative arguments to include when calling the command.
$exit_on_error (bool) Whether to exit if the command returns an elevated return code.
$return_detailed (bool) Whether to return an exit status (default) or detailed execution results.
$runtime_args (array) Override one or more global args (path,url,user,allow-root)
@return (int|ProcessRun) command exit status, or a ProcessRun instance

Top ↑


Use WP_CLI::runcommand() instead, which is easier to use and works better.

Note: While this command does persist a limited set of runtime arguments,
it does not persist environment variables. Practically speaking, WP-CLI
packages won’t be loaded when using WP_CLI::launch_self() because the
launched process doesn’t have access to the current process $HOME.

Internal APIAPI An API or Application Programming Interface is a software intermediary that allows programs to interact with each other and share data in limited, clearly defined ways. documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.

Top ↑

Last updated: