WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/untrailingslashit

Description

Removes trailing slash if it exists.

The primary use of this is for paths and thus should be used for paths. It is not restricted to paths and offers no specific path support.

Usage

<?php untrailingslashit$string ); ?>

Parameters

$string
(string) (required) What to remove the trailing slash from.
Default: None

Return Values

(string) 
String without the trailing slash.

Examples

Notes

  • This: '/' is a slash.

Change Log

Since: 2.2.0

Source File

untrailingslashit() is located in wp-includes/formatting.php.

Related

trailingslashit()

See also index of Function Reference and index of Template Tags.