the_shortlink
Filters the short link anchor tag for a post.
Description
apply_filters( 'the_shortlink', (string) $link, (string) $shortlink, (string) $text, (string) $title );
Parameters (4)
- 0. $link (string)
- Shortlink anchor tag.
- 1. $shortlink (string)
- The shortlink.
- 2. $text (string)
- Shortlink's text.
- 3. $title (string)
- Shortlink's title attribute.
Usage
- To run the hook, copy the example below.
- $link = apply_filters( 'the_shortlink', $link, $shortlink, $text, $title );
- if ( !empty( $link ) ) {
- // everything has led up to this point...
- }
- The following example is for adding a hook callback.
- // define the the_shortlink callback
- function filter_the_shortlink( $link, $shortlink, $text, $title ) {
- // make filter magic happen here...
- return $link;
- };
- // add the filter
- add_filter( 'the_shortlink', 'filter_the_shortlink', 10, 4 );
- To remove a hook callback, use the example below.
- // remove the filter
- remove_filter( 'the_shortlink', 'filter_the_shortlink', 10, 4 );
Defined (1)
The filter is defined in the following location(s).
- /wp-includes/link-template.php
- $link = apply_filters( 'the_shortlink', $link, $shortlink, $text, $title );