# rest_validate_array_contains_unique_items()

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

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

## Сигнатура

```php
rest_validate_array_contains_unique_items( array $input_array ): bool
```

## Описание

Проверяет, состоит ли массив из уникальных элементов.

## Параметры

- `$input_array` `array` — обязательный. Массив для проверки.

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

`bool`

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

Файл: `wp-includes/rest-api.php:1750`

```php
function rest_validate_array_contains_unique_items( $input_array ) {
	$seen = array();

	foreach ( $input_array as $item ) {
		$stabilized = rest_stabilize_value( $item );
		$key        = serialize( $stabilized );

		if ( ! isset( $seen[ $key ] ) ) {
			$seen[ $key ] = true;

			continue;
		}

		return false;
	}

	return true;
}
```

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

- 5.5.0 — Introduced.

## Связанные

Использует: [`rest_stabilize_value`](https://chugunov.pro/api-wordpress/functions/rest_stabilize_value/).
Используется в: [`rest_validate_array_value_from_schema`](https://chugunov.pro/api-wordpress/functions/rest_validate_array_value_from_schema/), [`rest_sanitize_value_from_schema`](https://chugunov.pro/api-wordpress/functions/rest_sanitize_value_from_schema/).

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