// If there's still no sanitize_callback, nothing to do here.
if ( empty( $param_args['sanitize_callback'
] ) ) { continue;
} /** @var mixed|WP_Error $sanitized_value */
$sanitized_value =
call_user_func( $param_args['sanitize_callback'
],
$value,
$this,
$key );
if ( is_wp_error( $sanitized_value ) ) { $invalid_params[ $key ] =
implode( ' ',
$sanitized_value->
get_error_messages() );
$invalid_details[ $key ] =
rest_convert_error_to_response( $sanitized_value )->
get_data();
} else { $this->params
[ $type ][ $key ] =
$sanitized_value;
} } } if ( $invalid_params ) { return new WP_Error( 'rest_invalid_param',
/* translators: %s: List of invalid parameters. */
sprintf( __( 'Invalid parameter(s): %s'
),
implode( ', ',
array_keys( $invalid_params ) ) ),