diff --git a/includes/functions.php b/includes/functions.php index da0ed9542f7c30b01d1f77c0ff5544fc12600b50..94c175b7f09e383bb73dac8bda4a178582285485 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -30,10 +30,12 @@ function schedule_cli_command( $command, $timestamp = null ) { /** * Validate WP-CLI command to be scheduled * - * @param string $args + * @param string $command * @return array|\WP_Error */ function validate_command( $command ) { + $command = trim( $command ); + // Strip `wp` if included if ( 0 === stripos( $command, 'wp' ) ) { $command = trim( substr( $command, 2 ) ); @@ -48,7 +50,7 @@ function validate_command( $command ) { // Don't worry about the user WP-CLI runs as if ( false === stripos( $command, '--allow-root' ) ) { - $args .= ' --allow-root'; + $command .= ' --allow-root'; } // TODO: validate further