Languages: English • 日本語 (Add your language)
Used on single post permalink pages, this template tag displays a "URL shortening" link for the current post. By default, this will mean the URL has a format of /?p=1234, and will only appear if pretty permalinks are enabled.
However, this feature is limited by design and intended to be leveraged by plugins that may offer links in a different format, a custom format, or even a format provided by a third-party URL shortening service. Refer to get_permalink() if you want to return the permalink to a post for use in PHP.
This tag can not be used outside of The Loop.
Note: This function outputs the complete shortlink for the post, to return the shortlink use wp_get_shortlink().
<?php the_shortlink( $text, $title, $before, $after ); ?>
Displays link with "This is the short link." as the text.
<?php the_shortlink(); ?>
Displays link with the specified text.
<?php the_shortlink(__('Shortlinkage FTW')); ?>
Displays link with prefix and suffix HTML that will appear only when the shortlink URL is available.
<?php the_shortlink('short link', null, '<ul><li>', '</li></ul>'); ?>
the_shortlink() is located in wp-includes/link-template.php
.