diff --git a/src/wp-includes/rest-api.php b/src/wp-includes/rest-api.php
index 0cce9fa62f..26ca9297ff 100644
|
a
|
b
|
function rest_validate_value_from_schema( $value, $args, $param = '' ) { |
| 1144 | 1144 | return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s is not of type %2$s.' ), $param, 'string' ) ); |
| 1145 | 1145 | } |
| 1146 | 1146 | |
| | 1147 | if ( 'string' === $args['type'] && ! empty( $args['pattern'] ) ) { |
| | 1148 | if ( ! preg_match( $args['pattern'], $value ) ) { |
| | 1149 | return new WP_Error( 'rest_invalid_pattern', sprintf( __( '%1$s does not match pattern %s$s.' ), $param, $args['pattern'] ) ); |
| | 1150 | } |
| | 1151 | } |
| | 1152 | |
| 1147 | 1153 | if ( isset( $args['format'] ) ) { |
| 1148 | 1154 | switch ( $args['format'] ) { |
| 1149 | 1155 | case 'date-time': |