rest_parse_request_arg

The timeline below displays how wordpress function rest_parse_request_arg has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 5.5

/**
 * Parse a request argument based on details registered to the route.
 *
 * Runs a validation check and sanitizes the value, primarily to be used via
 * the `sanitize_callback` arguments in the endpoint args registration.
 *
 * @since 4.7.0
 *
 * @param mixed           $value
 * @param WP_REST_Request $request
 * @param string          $param
 * @return mixed
 */
function rest_parse_request_arg($value, $request, $param)
{
    $is_valid = rest_validate_request_arg($value, $request, $param);
    if (is_wp_error($is_valid)) {
        return $is_valid;
    }
    $value = rest_sanitize_request_arg($value, $request, $param);
    return $value;
}

WordPress Version: 4.7

/**
 * Parse a request argument based on details registered to the route.
 *
 * Runs a validation check and sanitizes the value, primarily to be used via
 * the `sanitize_callback` arguments in the endpoint args registration.
 *
 * @since 4.7.0
 *
 * @param  mixed            $value
 * @param  WP_REST_Request  $request
 * @param  string           $param
 * @return mixed
 */
function rest_parse_request_arg($value, $request, $param)
{
    $is_valid = rest_validate_request_arg($value, $request, $param);
    if (is_wp_error($is_valid)) {
        return $is_valid;
    }
    $value = rest_sanitize_request_arg($value, $request, $param);
    return $value;
}