WP_CLI::run_command()public staticWP-CLI 1.0

Run a given command within the current process using the same global parameters.

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

To run a command using a new process with the same global parameters, use WP_CLI::launch_self(). To run a command using a new process with different global parameters, use WP_CLI::launch().

WP_CLI::run_command( array( 'cli', 'cmd-dump' ) );
$ret = ob_get_clean();

Method of the class: WP_CLI{}

No Hooks.


null. Nothing (null).


$result = WP_CLI::run_command( $args, $assoc_args );
$args(array) (required)
Positional arguments including command name.
Default: []

WP_CLI::run_command() code WP-CLI 2.8.0-alpha

public static function run_command( $args, $assoc_args = [] ) {
	self::get_runner()->run_command( $args, $assoc_args );