wp_shortlink_header()
Sends a Link: rel=shortlink header if a shortlink is defined for the current page.
Attached to the wp action.
Uses: wp_get_shortlink()
No Hooks.
Return
null
. Nothing (null).
Usage
wp_shortlink_header();
Examples
#1 Remove the short link to the current post from the server response header
remove_action( 'template_redirect', 'wp_shortlink_header', 11 );
Changelog
Since 3.0.0 | Introduced. |
wp_shortlink_header() wp shortlink header code WP 6.8
function wp_shortlink_header() { if ( headers_sent() ) { return; } $shortlink = wp_get_shortlink( 0, 'query' ); if ( empty( $shortlink ) ) { return; } header( 'Link: <' . $shortlink . '>; rel=shortlink', false ); }