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.
  1. $link = apply_filters( 'the_shortlink', $link, $shortlink, $text, $title ); 
  2.  
  3. if ( !empty( $link ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the the_shortlink callback 
  2. function filter_the_shortlink( $link, $shortlink, $text, $title ) { 
  3. // make filter magic happen here... 
  4. return $link
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'the_shortlink', 'filter_the_shortlink', 10, 4 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. 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  
  1. $link = apply_filters( 'the_shortlink', $link, $shortlink, $text, $title );