Summery Summery
Displays the shortlink for a post.
Syntax Syntax
Description Description
Must be called from inside "The Loop"
Call like the_shortlink( __( ‘Shortlinkage FTW’ ) )
Parameters Parameters
- $text
-
(Optional) The link text or HTML to be displayed. Defaults to 'This is the short link.'
Default value: ''
- $title
-
(Optional) The tooltip for the link. Must be sanitized. Defaults to the sanitized post title.
Default value: ''
- $before
-
(Optional) HTML to display before the link.
Default value: ''
- $after
-
(Optional) HTML to display after the link.
Default value: ''
Source Source
File: wp-includes/link-template.php
if ( empty( $shortlink ) ) { return; } header( 'Link: <' . $shortlink . '>; rel=shortlink', false ); } /** * Displays the shortlink for a post. * * Must be called from inside "The Loop" * * Call like the_shortlink( __( 'Shortlinkage FTW' ) ) * * @since 3.0.0 * * @param string $text Optional The link text or HTML to be displayed. Defaults to 'This is the short link.' * @param string $title Optional The tooltip for the link. Must be sanitized. Defaults to the sanitized post title. * @param string $before Optional HTML to display before the link. Default empty. * @param string $after Optional HTML to display after the link. Default empty. */ function the_shortlink( $text = '', $title = '', $before = '', $after = '' ) { $post = get_post(); if ( empty( $text ) ) { $text = __( 'This is the short link.' ); } if ( empty( $title ) ) { $title = the_title_attribute( array( 'echo' => false ) );
Advertisement
Changelog Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |