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.
This tag must be used in The Loop.
%%% <?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, '
- ', '
- (string) Link text to display. Defaults to "This is the short link."
- (string) Tool-tip text displayed with the link. Defaults to the post title.
- (string) Text or HTML prefix added to the link.
- (string) Text or HTML suffix added to the link.
the_permalink() is located in
- Since: 3.0.0