wp_shortlink_wp_head()WP 3.0.0

Injects rel=shortlink into the head if a shortlink is defined for the current page.

Attached to the wp_head action.

No Hooks.

Return

null. Nothing (null).

Usage

wp_shortlink_wp_head();

Examples

0

#1 Cancel the short link to the post in the HTML <head> part of the web page

remove_action( 'wp_head', 'wp_shortlink_wp_head' );

Changelog

Since 3.0.0 Introduced.

wp_shortlink_wp_head() code WP 6.5.2

function wp_shortlink_wp_head() {
	$shortlink = wp_get_shortlink( 0, 'query' );

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

	echo "<link rel='shortlink' href='" . esc_url( $shortlink ) . "' />\n";
}