Codex tools: Log in
Languages: English • 日本語 • (Add your language)
Contents |
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 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 "The 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.
body_class(), next_image_link(), next_post_link(), next_posts_link(), post_class(), post_password_required(), posts_nav_link(), previous_image_link(), previous_post_link(), previous_posts_link(), single_post_title, sticky_class(), the_category(), the_category_rss(), the_content(), the_content_rss(), the_excerpt(), the_excerpt_rss(), the_ID(), the_meta(), the_shortlink(), the_tags(), the_title(), the_title_attribute(), the_title_rss(), wp_link_pages()