WP_CLI::get_config()public staticWP-CLI 1.0

Get values of global configuration parameters.

Provides access to --path=<path>, --url=<url>, and other values of the global configuration parameters.

WP_CLI::log( 'The --url=<url> value is: ' . WP_CLI::get_config( 'url' ) );

Method of the class: WP_CLI{}

No Hooks.

Return

Mixed.

Usage

$result = WP_CLI::get_config( $key );
$key(string)
Get value for a specific global configuration parameter.
Default: null

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

public static function get_config( $key = null ) {
	if ( null === $key ) {
		return self::get_runner()->config;
	}

	if ( ! isset( self::get_runner()->config[ $key ] ) ) {
		self::warning( "Unknown config option '$key'." );
		return null;
	}

	return self::get_runner()->config[ $key ];
}