Filter hook 'user_trailingslashit'

in WP Core File wp-includes/link-template.php at line 65

View Source

user_trailingslashit

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

Hook Information

File Location wp-includes/link-template.php View on GitHub
Hook Type Filter
Line Number 65

Hook Parameters

Type Name Description
string $url URL with or without a trailing slash.
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'.

Usage Examples

Basic Usage
<?php
// Hook into user_trailingslashit
add_filter('user_trailingslashit', 'my_custom_filter', 10, 2);

function my_custom_filter($url, $type_of_url) {
    // Your custom filtering logic here
    return $url;
}

Source Code Context

wp-includes/link-template.php:65 - How this hook is used in WordPress core
<?php
  60  	 * @param string $url         URL with or without a trailing slash.
  61  	 * @param string $type_of_url The type of URL being considered. Accepts 'single', 'single_trackback',
  62  	 *                            'single_feed', 'single_paged', 'commentpaged', 'paged', 'home', 'feed',
  63  	 *                            'category', 'page', 'year', 'month', 'day', 'post_type_archive'.
  64  	 */
  65  	return apply_filters( 'user_trailingslashit', $url, $type_of_url );
  66  }
  67  
  68  /**
  69   * Displays the permalink anchor for the current post.
  70   *

PHP Documentation

<?php
/**
	 * Filters the trailing-slashed string, depending on whether the site is set to use trailing slashes.
	 *
	 * @since 2.2.0
	 *
	 * @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'.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/link-template.php
Related Hooks

Related hooks will be displayed here in future updates.