# get_archive_template()

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

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

## Сигнатура

```php
get_archive_template(): string
```

## Описание

Иерархия шаблонов и путь к шаблону могут быть отфильтрованы через динамические хуки '$type_template_hierarchy' и '$type_template', где $type равно 'archive'.
См. alsoget_query_template()

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

`string`

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

Файл: `wp-includes/template.php:150`

```php
function get_archive_template() {
	$post_types = array_filter( (array) get_query_var( 'post_type' ) );

	$templates = array();

	if ( count( $post_types ) === 1 ) {
		$post_type   = reset( $post_types );
		$templates[] = "archive-{$post_type}.php";
	}
	$templates[] = 'archive.php';

	return get_query_template( 'archive', $templates );
}
```

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

- 1.5.0 — Introduced.

## Связанные

Использует: [`get_query_var`](https://chugunov.pro/api-wordpress/functions/get_query_var/), `WP_Query`, [`get_query_template`](https://chugunov.pro/api-wordpress/functions/get_query_template/).
Используется в: [`get_post_type_archive_template`](https://chugunov.pro/api-wordpress/functions/get_post_type_archive_template/).

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