user_trailingslashit

Filters the trailing-slashed string, depending on whether the site is set to use trailing slashes.

Description

apply_filters( 'user_trailingslashit', (string) $string, (string) $type_of_url ); 

Parameters (2)

0. $string (string)
URL with or without a trailing slash.
1. $type_of_url (string)
The type of URL being considered. Accepts single,, single_trackback., single_feed, single_paged, commentpaged, paged, home, feed, category, page, year, month, day, post_type_archive.

Usage

To run the hook, copy the example below.
  1. $string = apply_filters( 'user_trailingslashit', $string, $type_of_url ); 
  2.  
  3. if ( !empty( $string ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the user_trailingslashit callback 
  2. function filter_user_trailingslashit( $string, $type_of_url ) { 
  3. // make filter magic happen here... 
  4. return $string
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'user_trailingslashit', 'filter_user_trailingslashit', 10, 2 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'user_trailingslashit', 'filter_user_trailingslashit', 10, 2 ); 

Defined (1)

The filter is defined in the following location(s).

/wp-includes/link-template.php  
  1. return apply_filters( 'user_trailingslashit', $string, $type_of_url );