# rest_find_any_matching_schema()

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

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

## Сигнатура

```php
rest_find_any_matching_schema( mixed $value, array $args, string $param ): array|WP_Error
```

## Описание

Находит подходящую схему среди схем «anyOf».

## Параметры

- `$value` `mixed` — обязательный. Значение для проверки.
- `$args` `array` — обязательный. Используемый массив схемы.
- `$param` `string` — обязательный. Имя параметра, используемое в сообщениях об ошибках.

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

`array|WP_Error` — WP_Error

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

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

```php
function rest_find_any_matching_schema( $value, $args, $param ) {
	$errors = array();

	foreach ( $args['anyOf'] as $index => $schema ) {
		if ( ! isset( $schema['type'] ) && isset( $args['type'] ) ) {
			$schema['type'] = $args['type'];
		}

		$is_valid = rest_validate_value_from_schema( $value, $schema, $param );
		if ( ! is_wp_error( $is_valid ) ) {
			return $schema;
		}

		$errors[] = array(
			'error_object' => $is_valid,
			'schema'       => $schema,
			'index'        => $index,
		);
	}

	return rest_get_combining_operation_error( $value, $param, $errors );
}
```

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

- 5.6.0 — Introduced.

## Связанные

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

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