user_trailingslashit
Filters the trailing-slashed string, depending on whether the site is set to use trailing slashes.
Usage
add_filter( 'user_trailingslashit', 'wp_kama_user_trailingslashit_filter', 10, 2 ); /** * Function for `user_trailingslashit` filter-hook. * * @param string $url URL with or without a trailing slash. * @param string $type_of_url 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'. * * @return string */ function wp_kama_user_trailingslashit_filter( $url, $type_of_url ){ // filter... return $url; }
- $url(string)
- URL with or without a trailing slash.
- $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'.
Changelog
Since 2.2.0 | Introduced. |
Where the hook is called
user_trailingslashit
wp-includes/link-template.php 65
return apply_filters( 'user_trailingslashit', $url, $type_of_url );