# get_post_type_archive_template()

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

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

## Сигнатура

```php
get_post_type_archive_template(): string
```

## Описание

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

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

`string`

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

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

```php
function get_post_type_archive_template() {
	$post_type = get_query_var( 'post_type' );
	if ( is_array( $post_type ) ) {
		$post_type = reset( $post_type );
	}

	$obj = get_post_type_object( $post_type );
	if ( ! ( $obj instanceof WP_Post_Type ) || ! $obj->has_archive ) {
		return '';
	}

	return get_archive_template();
}
```

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

- 3.7.0 — Introduced.

## Связанные

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

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