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{}

No Hooks.

Return

null. Nothing.

Usage

$result = WP_CLI::warning( $message );
$message(string|WP_Error|Exception|Throwable) (required)
Message to write to STDERR.

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

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

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