# get_raw_theme_root()

URL: https://chugunov.pro/api-wordpress/functions/get_raw_theme_root/
Проверено на WordPress 6.9, обновлено 06.08.2026.
Источник: независимый русскоязычный справочник chugunov.pro. Не является официальной документацией WordPress.

Тип: функция.
Появился в версии: 3.1.0.

## Сигнатура

```php
get_raw_theme_root( string $stylesheet_or_template, bool $skip_cache = false ): string
```

## Описание

Получает необработанный корневой каталог темы относительно каталога содержимого без применения фильтров.

## Параметры

- `$stylesheet_or_template` `string` — обязательный. Имя таблицы стилей или шаблона темы.
- `$skip_cache` `bool` — необязательный, по умолчанию `false`. Пропускать ли кэш.
  
  По умолчанию false, то есть кэш используется.

## Возвращаемое значение

`string`

## Исходный код

Файл: `wp-includes/theme.php:697`

```php
function get_raw_theme_root( $stylesheet_or_template, $skip_cache = false ) {
	global $wp_theme_directories;

	if ( ! is_array( $wp_theme_directories ) || count( $wp_theme_directories ) <= 1 ) {
		return '/themes';
	}

	$theme_root = false;

	// If requesting the root for the active theme, consult options to avoid calling get_theme_roots().
	if ( ! $skip_cache ) {
		if ( get_option( 'stylesheet' ) === $stylesheet_or_template ) {
			$theme_root = get_option( 'stylesheet_root' );
		} elseif ( get_option( 'template' ) === $stylesheet_or_template ) {
			$theme_root = get_option( 'template_root' );
		}
	}

	if ( empty( $theme_root ) ) {
		$theme_roots = get_theme_roots();
		if ( ! empty( $theme_roots[ $stylesheet_or_template ] ) ) {
			$theme_root = $theme_roots[ $stylesheet_or_template ];
		}
	}

	return $theme_root;
}
```

## История изменений

- 3.1.0 — Introduced.

## Связанные

Использует: [`get_theme_roots`](https://chugunov.pro/api-wordpress/functions/get_theme_roots/), [`get_option`](https://chugunov.pro/api-wordpress/functions/get_option/).
Используется в: `WP_Customize_Manager::get_template_root`, `WP_Customize_Manager::get_stylesheet_root`, [`get_theme_root`](https://chugunov.pro/api-wordpress/functions/get_theme_root/), [`get_theme_root_uri`](https://chugunov.pro/api-wordpress/functions/get_theme_root_uri/), [`switch_theme`](https://chugunov.pro/api-wordpress/functions/switch_theme/), [`wp_get_themes`](https://chugunov.pro/api-wordpress/functions/wp_get_themes/), `WP_Theme`, [`wp_get_theme`](https://chugunov.pro/api-wordpress/functions/wp_get_theme/).

Оригинал в официальной документации: https://developer.wordpress.org/reference/functions/get_raw_theme_root/
