Example #1
0
/**
 * Send a Link header for the API.
 */
function vp_rest_output_link_header()
{
    if (headers_sent()) {
        return;
    }
    $api_root = get_vp_rest_url();
    if (empty($api_root)) {
        return;
    }
    header('Link: <' . esc_url_raw($api_root) . '>; rel="https://github.com/WP-API/WP-API"', false);
}
Example #2
0
/**
 * Get URL to a REST endpoint.
 *
 * @param string $path   Optional. REST route. Default empty.
 * @param string $scheme Optional. Sanitization scheme. Default 'json'.
 * @return string Full URL to the endpoint.
 */
function vp_rest_url($path = '', $scheme = 'json')
{
    return get_vp_rest_url(null, $path, $scheme);
}