WP_CLI
Runner::register_early_invoke
Register a command for early invocation, generally before WordPress loads.
Method of the class: Runner{}
No Hooks.
Returns
null. Nothing (null).
Usage
$Runner = new Runner(); $Runner->register_early_invoke( $when, $command );
- $when(string) (required)
- Named execution hook.
- $command(Subcommand) (required)
- .
Runner::register_early_invoke() Runner::register early invoke code WP-CLI 2.13.0-alpha
public function register_early_invoke( $when, $command ) {
$cmd_path = array_slice( Dispatcher\get_path( $command ), 1 );
$command_name = implode( ' ', $cmd_path );
WP_CLI::debug( "Attaching command '{$command_name}' to hook {$when}", 'bootstrap' );
$this->early_invoke[ $when ][] = $cmd_path;
if ( $command->get_alias() ) {
array_pop( $cmd_path );
$cmd_path[] = $command->get_alias();
$alias_name = implode( ' ', $cmd_path );
WP_CLI::debug( "Attaching command alias '{$alias_name}' to hook {$when}", 'bootstrap' );
$this->early_invoke[ $when ][] = $cmd_path;
}
}