# single_term_title()

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

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

## Сигнатура

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

## Описание

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

## Параметры

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

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

`string|null`

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

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

```php
function single_term_title( $prefix = '', $display = true ) {
	$term = get_queried_object();

	if ( ! $term ) {
		return null;
	}

	if ( is_category() ) {
		/**
		 * Filters the category archive page title.
		 *
		 * @since 2.0.10
		 *
		 * @param string $term_name Category name for archive being displayed.
		 */
		$term_name = apply_filters( 'single_cat_title', $term->name );
	} elseif ( is_tag() ) {
		/**
		 * Filters the tag archive page title.
		 *
		 * @since 2.3.0
		 *
		 * @param string $term_name Tag name for archive being displayed.
		 */
		$term_name = apply_filters( 'single_tag_title', $term->name );
	} elseif ( is_tax() ) {
		/**
		 * Filters the custom taxonomy archive page title.
		 *
		 * @since 3.1.0
		 *
		 * @param string $term_name Term name for archive being displayed.
		 */
		$term_name = apply_filters( 'single_term_title', $term->name );
	} else {
		return null;
	}

	if ( empty( $term_name ) ) {
		return null;
	}

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

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

- 3.1.0 — Introduced.

## Связанные

Использует: [`is_category`](https://chugunov.pro/api-wordpress/functions/is_category/), [`is_tag`](https://chugunov.pro/api-wordpress/functions/is_tag/), [`is_tax`](https://chugunov.pro/api-wordpress/functions/is_tax/), [`get_queried_object`](https://chugunov.pro/api-wordpress/functions/get_queried_object/), [`apply_filters`](https://chugunov.pro/api-wordpress/functions/apply_filters/).
Используется в: [`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/), [`single_cat_title`](https://chugunov.pro/api-wordpress/functions/single_cat_title/), [`single_tag_title`](https://chugunov.pro/api-wordpress/functions/single_tag_title/).

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