You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 81e5e72
Browse filesBrowse the repository at this point in the historyBrowse files
WP_CLI::error( 'The --hook parameter must be a non-empty string.' );
45
+
}
46
+
42
47
// Check if the hook has already fired.
43
48
if ( did_action( $hook ) ) {
44
49
// Hook already fired, start the shell immediately.
45
50
$this->start_shell( $assoc_args );
46
51
} else {
47
-
// Hook hasn't fired yet. We need to attach a callback and let WordPress continue.
48
-
// Since shell is interactive and blocks execution, we'll attach the callback
49
-
// and let it start when the hook fires naturally.
50
-
$shell_started = false;
51
-
add_action(
52
-
$hook,
53
-
function () use ( $assoc_args, &$shell_started ) {
54
-
if ( ! $shell_started ) {
55
-
$shell_started = true;
56
-
$this->start_shell( $assoc_args );
57
-
}
58
-
},
59
-
10
52
+
// Hook hasn't fired yet.
53
+
WP_CLI::error(
54
+
sprintf(
55
+
"The '%s' hook has not fired yet. The shell command runs after WordPress is loaded, so only hooks that have already been triggered can be used. Common hooks that are available include: init, plugins_loaded, wp_loaded, admin_init.",
56
+
$hook
57
+
)
60
58
);
61
-
// Note: The shell will start when the hook fires during WordPress lifecycle.
62
-
// Since commands typically run after WordPress is loaded, most common hooks
63
-
// will have already fired. For hooks that haven't fired yet, the shell will
0 commit comments