untrailingslashit( string $string )

Removes trailing forward slashes and backslashes if they exist.

Description 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 Parameters


(string) (Required) What to remove the trailing slashes from.

Top ↑

Return Return

(string) String without the trailing slashes.

Top ↑

Source Source

File: wp-includes/formatting.php

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

Top ↑

Changelog Changelog

Version Description
2.2.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.