Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bail early on add_command(). #4126

Merged
merged 1 commit into from Jun 2, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions php/class-wp-cli.php
Expand Up @@ -396,6 +396,11 @@ private static function wp_hook_build_unique_id( $tag, $function, $priority ) {
* @return true True on success, false if deferred, hard error if registration failed.
*/
public static function add_command( $name, $callable, $args = array() ) {
// Bail immediately if the WP-CLI executable has not been run.
if ( ! defined( 'WP_CLI' ) ) {
return false;
}

$valid = false;
if ( is_callable( $callable ) ) {
$valid = true;
Expand Down