# post_custom()

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

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

## Сигнатура

```php
post_custom( string $key = '' ): array|string|false
```

## Описание

Получает поле произвольных метаданных записи.

## Параметры

- `$key` `string` — необязательный, по умолчанию `''`. Имя ключа метаданных.

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

`array|string|false`

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

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

```php
function post_custom( $key = '' ) {
	$custom = get_post_custom();

	if ( ! isset( $custom[ $key ] ) ) {
		return false;
	} elseif ( 1 === count( $custom[ $key ] ) ) {
		return $custom[ $key ][0];
	} else {
		return $custom[ $key ];
	}
}
```

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

- 1.5.0 — Introduced.

## Связанные

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

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