WP_CLI::warning()public staticWP-CLI 1.0

Display warning message prefixed with "Warning: ".

Warning message is written to STDERR.

Use instead of WP_CLI::debug() when script execution should be permitted to continue.

# `wp plugin activate` skips activation when plugin is network active.
$status = $this->get_status( $plugin->file );
// Network-active is the highest level of activation status
if ( 'active-network' === $status ) {
  WP_CLI::warning( "Plugin '{$plugin->name}' is already network active." );
  continue;
}

Метод класса: WP_CLI{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$result = WP_CLI::warning( $message );
$message(строка|WP_Error|Exception|Throwable) (обязательный)
Message to write to STDERR.

Код WP_CLI::warning() WP-CLI 2.8.0-alpha

public static function warning( $message ) {
	if ( null === self::$logger ) {
		return;
	}

	self::$logger->warning( self::error_to_string( $message ) );
}