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." );

Method of the class: WP_CLI{}

No Hooks.


null. Nothing (null).


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

WP_CLI::warning() code WP-CLI 2.8.0-alpha

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

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