# get_template_directory()

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

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

## Сигнатура

```php
get_template_directory(): string
```

## Описание

Возвращает путь к каталогу шаблона активной темы.

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

`string`

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

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

```php
function get_template_directory() {
	$template     = get_template();
	$theme_root   = get_theme_root( $template );
	$template_dir = "$theme_root/$template";

	/**
	 * Filters the active theme directory path.
	 *
	 * @since 1.5.0
	 *
	 * @param string $template_dir The path of the active theme directory.
	 * @param string $template     Directory name of the active theme.
	 * @param string $theme_root   Absolute path to the themes directory.
	 */
	return apply_filters( 'template_directory', $template_dir, $template, $theme_root );
}
```

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

- 6.4.1 — Memoization removed.
- 6.4.0 — Memoizes filter execution so that it only runs once for the current theme.
- 1.5.0 — Introduced.

## Связанные

Использует: [`get_theme_root`](https://chugunov.pro/api-wordpress/functions/get_theme_root/), [`get_template`](https://chugunov.pro/api-wordpress/functions/get_template/), [`apply_filters`](https://chugunov.pro/api-wordpress/functions/apply_filters/).
Используется в: `WP_Debug_Data::get_wp_parent_theme`, [`wp_set_template_globals`](https://chugunov.pro/api-wordpress/functions/wp_set_template_globals/), [`get_block_asset_url`](https://chugunov.pro/api-wordpress/functions/get_block_asset_url/), [`wp_theme_has_theme_json`](https://chugunov.pro/api-wordpress/functions/wp_theme_has_theme_json/), `WP_Theme_JSON_Resolver::get_style_variations`, [`_get_block_template_file`](https://chugunov.pro/api-wordpress/functions/_get_block_template_file/), [`_get_block_templates_files`](https://chugunov.pro/api-wordpress/functions/_get_block_templates_files/), `WP_Theme_JSON_Resolver::get_file_path_from_theme`, [`locate_block_template`](https://chugunov.pro/api-wordpress/functions/locate_block_template/), [`resolve_block_template`](https://chugunov.pro/api-wordpress/functions/resolve_block_template/), `WP_Customize_Manager::prepare_starter_content_attachments`, [`get_parent_theme_file_path`](https://chugunov.pro/api-wordpress/functions/get_parent_theme_file_path/), [`get_theme_file_path`](https://chugunov.pro/api-wordpress/functions/get_theme_file_path/), [`get_theme_file_uri`](https://chugunov.pro/api-wordpress/functions/get_theme_file_uri/), [`_load_textdomain_just_in_time`](https://chugunov.pro/api-wordpress/functions/_load_textdomain_just_in_time/), [`get_editor_stylesheets`](https://chugunov.pro/api-wordpress/functions/get_editor_stylesheets/), [`validate_current_theme`](https://chugunov.pro/api-wordpress/functions/validate_current_theme/), [`load_theme_textdomain`](https://chugunov.pro/api-wordpress/functions/load_theme_textdomain/), [`get_attachment_icon_src`](https://chugunov.pro/api-wordpress/functions/get_attachment_icon_src/), [`wp_templating_constants`](https://chugunov.pro/api-wordpress/functions/wp_templating_constants/).

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