diff --git a/includes/functions.php b/includes/functions.php index 9138fbc1fbf9d31cb59bacfbaf70997399b51758..689d48f3b34ac5110c87fe437f538ee285fbefd4 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -85,23 +85,10 @@ function is_command_allowed( $command ) { return false; } - // If there's a whitelist, default to it. - if ( ! empty( get_command_whitelist() ) ) { - add_filter( 'wp_cli_cron_control_offload_is_command_allowed', __NAMESPACE__ . '\command_is_whitelisted', 9, 2 ); - } - - return apply_filters( 'wp_cli_cron_control_offload_is_command_allowed', true, $command ); -} + // Default to command whitelist. + $whitelisted = in_array( $command, get_command_whitelist(), true ); -/** - * Filter callback to check a command against a whitelist - * - * @param bool $whitelisted Command is allowed. - * @param string $command Command to check. - * @return bool - */ -function command_is_whitelisted( $whitelisted, $command ) { - return in_array( $command, get_command_whitelist(), true ); + return apply_filters( 'wp_cli_cron_control_offload_is_command_allowed', $whitelisted, $command ); } /**