# the_category_head()

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

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

> Устаревший элемент.

## Сигнатура

```php
the_category_head( string $before = '', string $after = '' )
```

## Описание

См. alsoget_the_category_by_ID()

## Параметры

- `$before` `string` — необязательный, по умолчанию `''`. Текст для вывода перед рубрикой.
- `$after` `string` — необязательный, по умолчанию `''`. Текст для вывода после рубрики.

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

Файл: `wp-includes/deprecated.php:107`

```php
function the_category_head( $before = '', $after = '' ) {
	global $currentcat, $previouscat;

	_deprecated_function( __FUNCTION__, '0.71', 'get_the_category_by_ID()' );

	// Grab the first cat in the list.
	$categories = get_the_category();
	$currentcat = $categories[0]->category_id;
	if ( $currentcat != $previouscat ) {
		echo $before;
		echo get_the_category_by_ID($currentcat);
		echo $after;
		$previouscat = $currentcat;
	}
}
```

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

- 0.71 — Introduced.

## Связанные

Использует: [`get_the_category`](https://chugunov.pro/api-wordpress/functions/get_the_category/), [`get_the_category_by_ID`](https://chugunov.pro/api-wordpress/functions/get_the_category_by_id/), [`_deprecated_function`](https://chugunov.pro/api-wordpress/functions/_deprecated_function/).

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