diff --git a/wp-includes/rest-api.php b/wp-includes/rest-api.php index 6c2e7b693b..cc600789f0 100644 --- a/wp-includes/rest-api.php +++ b/wp-includes/rest-api.php @@ -1382,6 +1382,14 @@ function rest_validate_value_from_schema( $value, $args, $param = '' ) { ) ); } + + if ( isset( $args['pattern'] ) ) { + $pattern = str_replace( '#', '\\#', $args['pattern'] ); + if ( ! preg_match( '#' . $pattern . '#u', $value ) ) { + /* translators: 1: Parameter, 2: Pattern. */ + return new WP_Error( 'rest_invalid_pattern', sprintf( __( '%1$s does not match pattern %2$s.' ), $param, $args['pattern'] ) ); + } + } } if ( isset( $args['format'] ) ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 306cf73786..f4866c9dee 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.5-alpha-47809'; +$wp_version = '5.5-alpha-47810'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.