WPDev.one
Core Function
View Source on Trac ↗

rest_find_one_matching_schema()

rest_find_one_matching_schema( mixed $value, mixed $args, mixed $param, mixed $stop_after_first_match = false )

Finds the matching schema among the "oneOf" schemas.

Parameters 3 required

Name / Type Description
$value
mixed

The value to validate.

Required
$args
array

The schema array to use.

Required
$param
string

The parameter name, used in error messages.

Required
$stop_after_first_match
bool

Optional. Whether the process should stop after the first successful match.

Return Value

((array)
| WP_Error) The matching schema or WP_Error instance if the number of matching schemas is not equal to one.

Function Information

Since Version
5.6.0
Source File
wp-includes/rest-api.php
Advertisement