wordpress / latest / functions / untrailingslashit.html

untrailingslashit( string $string ): string

Removes trailing forward slashes and backslashes if they exist.

Description

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.

Parameters

$string string Required
What to remove the trailing slashes from.

Return

string String without the trailing slashes.

Source

File: wp-includes/formatting.php. View all references

function untrailingslashit( $string ) {
	return rtrim( $string, '/\\' );
}

Used By

Used By Description

Changelog

Version Description
2.2.0 Introduced.

© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/untrailingslashit