trailingslashit( string $string )

Appends a trailing slash.


Description Description

Will remove trailing forward and backslashes if it exists already before adding a trailing forward slash. This prevents double slashing a string or path.

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

(string) (Required) What to add the trailing slash to.


Top ↑

Return Return

(string) String with trailing slash added.


Top ↑

Source Source

File: wp-includes/formatting.php

function trailingslashit( $string ) {
	return untrailingslashit( $string ) . '/';
}

Top ↑

Changelog Changelog

Changelog
Version Description
1.2.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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