Uses
| Uses | Description |
|---|---|
| wp-includes/formatting.php: esc_url() | Checks and cleans a URL. |
| wp-includes/link-template.php: wp_get_shortlink() | Returns a shortlink for a post, page, attachment, or site. |
Injects rel=shortlink into the head if a shortlink is defined for the current page.
Attached to the ‘wp_head’ action.
File: wp-includes/link-template.php
function wp_shortlink_wp_head() {
$shortlink = wp_get_shortlink( 0, 'query' );
if ( empty( $shortlink ) ) {
return;
}
echo "<link rel='shortlink' href='" . esc_url( $shortlink ) . "' />\n";
} | Version | Description |
|---|---|
| 3.0.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_shortlink_wp_head