function untrailingslashit($string) {}

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.


  • string $string: What to remove the trailing slash from.

Return values

returns:String without the trailing slash.

Source code

function untrailingslashit($string) {

	return rtrim($string, '/');



No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: