user_trailingslashit
Filters the trailing-slashed string, depending on whether the site is set to use trailing slashes.
Description
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.
- $string = apply_filters( 'user_trailingslashit', $string, $type_of_url );
- if ( !empty( $string ) ) {
- // everything has led up to this point...
- }
- The following example is for adding a hook callback.
- // define the user_trailingslashit callback
- function filter_user_trailingslashit( $string, $type_of_url ) {
- // make filter magic happen here...
- return $string;
- };
- // add the filter
- add_filter( 'user_trailingslashit', 'filter_user_trailingslashit', 10, 2 );
- To remove a hook callback, use the example below.
- // remove the filter
- 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
- return apply_filters( 'user_trailingslashit', $string, $type_of_url );