wp_get_user_request

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

WordPress Version: 6.1

/**
 * Returns the user request object for the specified request ID.
 *
 * @since 4.9.6
 *
 * @param int $request_id The ID of the user request.
 * @return WP_User_Request|false
 */
function wp_get_user_request($request_id)
{
    $request_id = absint($request_id);
    $post = get_post($request_id);
    if (!$post || 'user_request' !== $post->post_type) {
        return false;
    }
    return new WP_User_Request($post);
}

WordPress Version: 5.4

/**
 * Return the user request object for the specified request ID.
 *
 * @since 4.9.6
 *
 * @param int $request_id The ID of the user request.
 * @return WP_User_Request|false
 */
function wp_get_user_request($request_id)
{
    $request_id = absint($request_id);
    $post = get_post($request_id);
    if (!$post || 'user_request' !== $post->post_type) {
        return false;
    }
    return new WP_User_Request($post);
}