Title: wp_shortlink_header
Published: April 25, 2014
Last modified: May 20, 2026

---

# wp_shortlink_header()

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/wp_shortlink_header/?output_format=md#description)
 * [Source](https://developer.wordpress.org/reference/functions/wp_shortlink_header/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/wp_shortlink_header/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_shortlink_header/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/wp_shortlink_header/?output_format=md#wp--skip-link--target)

Sends a Link: rel=shortlink header if a shortlink is defined for the current page.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/wp_shortlink_header/?output_format=md#description)󠁿

Attached to the [‘wp’](https://developer.wordpress.org/reference/hooks/wp/) action.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/wp_shortlink_header/?output_format=md#source)󠁿

    ```php
    function wp_shortlink_header() {
    	if ( headers_sent() ) {
    		return;
    	}

    	$shortlink = wp_get_shortlink( 0, 'query' );

    	if ( empty( $shortlink ) ) {
    		return;
    	}

    	header( 'Link: <' . $shortlink . '>; rel=shortlink', false );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/link-template.php#L4236)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/link-template.php#L4236-L4248)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/wp_shortlink_header/?output_format=md#related)󠁿

| Uses | Description | 
| [wp_get_shortlink()](https://developer.wordpress.org/reference/functions/wp_get_shortlink/)`wp-includes/link-template.php` |

Returns a shortlink for a post, page, attachment, or site.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_shortlink_header/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_shortlink_header%2F)
before being able to contribute a note or feedback.