# the_category_ID()

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

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

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

## Сигнатура

```php
the_category_ID( bool $display = true ): int
```

## Описание

См. alsoget_the_category()

## Параметры

- `$display` `bool` — необязательный, по умолчанию `true`. Выводить ли результат.

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

`int`

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

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

```php
function the_category_ID($display = true) {
	_deprecated_function( __FUNCTION__, '0.71', 'get_the_category()' );

	// Grab the first cat in the list.
	$categories = get_the_category();
	$cat = $categories[0]->term_id;

	if ( $display )
		echo $cat;

	return $cat;
}
```

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

- 0.71 — Introduced.

## Связанные

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

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