untrailingslashit( $value ): 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

$textstringrequired
Value from which trailing slashes will be removed.

Return

string String without the trailing slashes.

Source

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

Changelog

VersionDescription
2.2.0Introduced.

User Contributed Notes

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