handbook/references/internal-api/wp-cli-run-command.md
Pascal Birchler 264cb131bf
Fix handbook information architecture
- Organize files in folders according to the desired structure
- Use directory iterator to loop through all files and folders (makes generation more robust)
2025-06-25 15:38:39 +02:00

1.4 KiB

WP_CLI::run_command()

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


Usage

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

Notes

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().

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

Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.