wp-includes/link-template.php:4256Displays the shortlink for a post.
$textstringoptional''$titlestringoptional''$beforestringoptional''$afterstringoptional''One hook fires while the_shortlink() runs, in this order:
Filters the short link anchor tag for a post.
function the_shortlink( $text = '', $title = '', $before = '', $after = '' ) { $post = get_post(); if ( empty( $text ) ) { $text = __( 'This is the short link.' ); } $shortlink = wp_get_shortlink( $post->ID ); if ( ! empty( $shortlink ) ) { $link = '<a rel="shortlink" href="' . esc_url( $shortlink ) . '">' . $text . '</a>'; /** * Filters the short link anchor tag for a post. * * @since 3.0.0 * * @param string $link Shortlink anchor tag. * @param string $shortlink Shortlink URL. * @param string $text Shortlink's text. * @param string $title Shortlink's title attribute. Unused. */ $link = apply_filters( 'the_shortlink', $link, $shortlink, $text, $title ); echo $before, $link, $after; }}Introduced in 3.0.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
src/wp-includes/link-template.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.