Skip to content

Commit 367b68f

Browse files
author
Jeremy Ward
committed
Relocate cli_init hook to end of setup_bootstrap_hooks and re-attach to WordPress init hook.
1 parent 630089b commit 367b68f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

php/WP_CLI/Runner.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -966,10 +966,6 @@ private function set_alias( $alias ) {
966966
}
967967

968968
public function start() {
969-
WP_CLI::add_wp_hook( 'plugins_loaded', function () {
970-
do_action( 'cli_init' );
971-
} );
972-
973969
// Enable PHP error reporting to stderr if testing. Will need to be re-enabled after WP loads.
974970
if ( getenv( 'BEHAT_RUN' ) ) {
975971
$this->enable_error_reporting();
@@ -1490,6 +1486,10 @@ function( $url, $path, $scheme, $blog_id ) {
14901486
4
14911487
);
14921488

1489+
// Set up hook for WP-CLI packages to use.
1490+
WP_CLI::add_wp_hook( 'init', function () {
1491+
do_action( 'cli_init' );
1492+
} );
14931493
}
14941494

14951495
/**

0 commit comments

Comments
 (0)