WPDev.one
Core Function
View Source on Trac ↗

rest_validate_enum()

rest_validate_enum( mixed $value, mixed $args, mixed $param )

Validates that the given value is a member of the JSON Schema "enum".

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

Return Value

((true)
| WP_Error) True if the "enum" contains the value or a WP_Error instance otherwise.

Function Information

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