user_trailingslashit ( $string, $type_of_url = '' )

  • (string) $string URL with or without a trailing slash.
  • (string) $type_of_url Optional. The type of URL being considered (e.g. single, category, etc) for use in the filter. Default empty string.
  • (string) The URL with the trailing slash appended or stripped.
Defined at:


Retrieves a trailing-slashed string if the site is set for adding trailing slashes.

Conditionally adds a trailing slash if the permalink structure has a trailing slash, strips the trailing slash if not. The string is passed through the {@see 'user_trailingslashit'} filter. Will remove trailing slash from string, if site is not set to have them.

Related Functions

untrailingslashit, trailingslashit, set_transient, get_user_details, wp_user_settings

Top Google Results

User discussions

wpseek mobile