# post_type_archive_title()

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

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

## Сигнатура

```php
post_type_archive_title( string $prefix = '', bool $display = true ): string|null
```

## Описание

This is optimized for archive.php and archive-{$post_type}.php template files for displaying the title of the post type.

## Параметры

- `$prefix` `string` — необязательный, по умолчанию `''`. Что отображать перед заголовком.
- `$display` `bool` — необязательный, по умолчанию `true`. Отображать или получать заголовок.

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

`string|null`

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

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

```php
function post_type_archive_title( $prefix = '', $display = true ) {
	if ( ! is_post_type_archive() ) {
		return null;
	}

	$post_type = get_query_var( 'post_type' );
	if ( is_array( $post_type ) ) {
		$post_type = reset( $post_type );
	}

	$post_type_obj = get_post_type_object( $post_type );

	/**
	 * Filters the post type archive title.
	 *
	 * @since 3.1.0
	 *
	 * @param string $post_type_name Post type 'name' label.
	 * @param string $post_type      Post type.
	 */
	$title = apply_filters( 'post_type_archive_title', $post_type_obj->labels->name, $post_type );

	if ( $display ) {
		echo $prefix . $title;
	} else {
		return $prefix . $title;
	}
}
```

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

- 3.1.0 — Introduced.

## Связанные

Использует: [`is_post_type_archive`](https://chugunov.pro/api-wordpress/functions/is_post_type_archive/), [`get_query_var`](https://chugunov.pro/api-wordpress/functions/get_query_var/), `WP_Query`, [`apply_filters`](https://chugunov.pro/api-wordpress/functions/apply_filters/), [`get_post_type_object`](https://chugunov.pro/api-wordpress/functions/get_post_type_object/).
Используется в: [`wp_get_document_title`](https://chugunov.pro/api-wordpress/functions/wp_get_document_title/), [`get_the_archive_title`](https://chugunov.pro/api-wordpress/functions/get_the_archive_title/), [`wp_title`](https://chugunov.pro/api-wordpress/functions/wp_title/).

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