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
This commit is contained in:
Rachel Baker 2021-10-15 02:04:56 +00:00
parent 8b8b5d8ecc
commit 1f261d083a
2 changed files with 8 additions and 1 deletions

View File

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

View File

@ -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.