WP_CLI

WpOrgApi::get_theme_info()publicWP-CLI 1.0

Gets a theme's info.

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

Хуков нет.

Возвращает

Массив|false. False on failure. Associative array of the offer on success.

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

$WpOrgApi = new WpOrgApi();
$WpOrgApi->get_theme_info( $theme, $locale );
$theme(строка) (обязательный)
Theme slug to query.
$locale(строка)
Locale to request info for.
По умолчанию: 'en_US'

Код WpOrgApi::get_theme_info() WP-CLI 2.8.0-alpha

public function get_theme_info( $theme, $locale = 'en_US' ) {
	$action  = 'theme_information';
	$request = [
		'locale' => $locale,
		'slug'   => $theme,
	];

	$url = sprintf(
		'%s?%s',
		self::THEME_INFO_ENDPOINT,
		http_build_query( compact( 'action', 'request' ), null, '&' )
	);

	$response = $this->json_get_request( $url );

	if ( ! is_array( $response ) ) {
		return false;
	}

	return $response;
}