Skip to content

when/do_hook not working (early)? #6098

@kkmuffme

Description

@kkmuffme

Bug Report

Describe the current, buggy behavior

In a object cache (object-cache.php) drop-in, any do_hook and 'when' are not executed.

function foo() {
    echo 'hello' . PHP_EOL;
}
WP_CLI::add_command( 'bar', 'foo', array( 'when' => 'run_this_early' ) );

WP_CLI::do_hook( 'run_this_early' );

Describe what you expect as the correct outcome

It should run the callback of the command where the do_hook is, but instead it won't but load the rest of WP

Let us know what environment you are running this on
WP CLI 2.12.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions