wp_shortlink_header

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

WordPress Version: 4.6

/**
 * Sends a Link: rel=shortlink header if a shortlink is defined for the current page.
 *
 * Attached to the {@see 'wp'} action.
 *
 * @since 3.0.0
 */
function wp_shortlink_header()
{
    if (headers_sent()) {
        return;
    }
    $shortlink = wp_get_shortlink(0, 'query');
    if (empty($shortlink)) {
        return;
    }
    header('Link: <' . $shortlink . '>; rel=shortlink', false);
}

WordPress Version: 4.1

/**
 * Send a Link: rel=shortlink header if a shortlink is defined for the current page.
 *
 * Attached to the wp action.
 *
 * @since 3.0.0
 */
function wp_shortlink_header()
{
    if (headers_sent()) {
        return;
    }
    $shortlink = wp_get_shortlink(0, 'query');
    if (empty($shortlink)) {
        return;
    }
    header('Link: <' . $shortlink . '>; rel=shortlink', false);
}

WordPress Version: 3.7

/**
 * Send a Link: rel=shortlink header if a shortlink is defined for the current page.
 *
 * Attached to the wp action.
 *
 * @since 3.0.0
 *
 * @uses wp_get_shortlink()
 */
function wp_shortlink_header()
{
    if (headers_sent()) {
        return;
    }
    $shortlink = wp_get_shortlink(0, 'query');
    if (empty($shortlink)) {
        return;
    }
    header('Link: <' . $shortlink . '>; rel=shortlink', false);
}