WP_CLI::get_config
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.
Returns
Mixed.
Usage
$result = WP_CLI::get_config( $key );
- $key(string)
- Get value for a specific global configuration parameter.
Default: null
WP_CLI::get_config() WP CLI::get config code WP-CLI 2.13.0-alpha
public static function get_config( $key = null ) {
if ( null === $key ) {
return self::get_runner()->config;
}
if ( ! self::has_config( $key ) ) {
self::warning( "Unknown config option '$key'." );
return null;
}
return self::get_runner()->config[ $key ];
}