函数原型
rest_find_matching_pattern_property_schema( string $property, array $args ): array|null
函数描述
Finds the schema for a property using the patternProperties keyword.
是否弃用
未弃用
函数参数
-
$property
string
Required - The property name to check.
-
$args
array
Required - The schema array to use.
函数返回值
array|null The schema of matching pattern property, or null if no patterns match.
函数位置
File: wp-includes/rest-api.php.
函数源码
function rest_find_matching_pattern_property_schema( $property, $args ) {
if ( isset( $args['patternProperties'] ) ) {
foreach ( $args['patternProperties'] as $pattern => $child_schema ) {
if ( rest_validate_json_schema_pattern( $pattern, $property ) ) {
return $child_schema;
}
}
}
return null;
}
源码链接
变更日志
| Version | Description |
|---|---|
| 5.6.0 | Introduced. |

