REST API: Use correct parameter name in rest_validate_value_from_schema() error messages.

Props manzoorwanijk.
Fixes #47905.

git-svn-id: https://develop.svn.wordpress.org/trunk@46101 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2019-09-13 03:05:15 +00:00
parent 2b4cecf316
commit 84f073cc52

View File

@ -1215,7 +1215,7 @@ function rest_validate_value_from_schema( $value, $args, $param = '' ) {
if ( 'boolean' === $args['type'] && ! rest_is_boolean( $value ) ) {
/* translators: 1: Parameter, 2: Type name. */
return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s is not of type %2$s.' ), $value, 'boolean' ) );
return new WP_Error( 'rest_invalid_param', sprintf( __( '%1$s is not of type %2$s.' ), $param, 'boolean' ) );
}
if ( 'string' === $args['type'] && ! is_string( $value ) ) {
@ -1239,7 +1239,7 @@ function rest_validate_value_from_schema( $value, $args, $param = '' ) {
case 'ip':
if ( ! rest_is_ip_address( $value ) ) {
/* translators: %s: IP address. */
return new WP_Error( 'rest_invalid_param', sprintf( __( '%s is not a valid IP address.' ), $value ) );
return new WP_Error( 'rest_invalid_param', sprintf( __( '%s is not a valid IP address.' ), $param ) );
}
break;
}