From 1f261d083acfa7b377d51053422bad531b3cb0f8 Mon Sep 17 00:00:00 2001 From: Rachel Baker Date: Fri, 15 Oct 2021 02:04:56 +0000 Subject: [PATCH] REST API: Add text-field and textarea-field as available schema formats for string sanitization. Props ocean90, TimothyBlynJacobs. Fixes #49960. Built from https://develop.svn.wordpress.org/trunk@51908 git-svn-id: http://core.svn.wordpress.org/trunk@51501 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/rest-api.php | 7 +++++++ wp-includes/version.php | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/wp-includes/rest-api.php b/wp-includes/rest-api.php index fb83e38f4c..7e66ecd801 100644 --- a/wp-includes/rest-api.php +++ b/wp-includes/rest-api.php @@ -2635,6 +2635,7 @@ function rest_validate_integer_value_from_schema( $value, $args, $param ) { * @since 4.7.0 * @since 5.5.0 Added the `$param` parameter. * @since 5.6.0 Support the "anyOf" and "oneOf" keywords. + * @since 5.9.0 Added `text-field` and `textarea-field` formats. * * @param mixed $value The value to sanitize. * @param array $args Schema array to use for sanitization. @@ -2777,6 +2778,12 @@ function rest_sanitize_value_from_schema( $value, $args, $param = '' ) { case 'uuid': return sanitize_text_field( $value ); + + case 'text-field': + return sanitize_text_field( $value ); + + case 'textarea-field': + return sanitize_textarea_field( $value ); } } diff --git a/wp-includes/version.php b/wp-includes/version.php index a70276b11c..f3a68403e7 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '5.9-alpha-51907'; +$wp_version = '5.9-alpha-51908'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.