A WordPress-centric search engine for devs and theme authors



rest_find_matching_pattern_property_schema ›

Since5.6.0
Deprecatedn/a
rest_find_matching_pattern_property_schema ( $property, $args )
Parameters: (2)
  • (string) $property The property name to check.
    Required: Yes
  • (array) $args The schema array to use.
    Required: Yes
Returns:
  • (array|null) The schema of matching pattern property, or null if no patterns match.
Defined at:
Codex:

Finds the schema for a property using the patternProperties keyword.



Source

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;
}