WordPress at a glance

trailingslashit() WP 1.0

Appends a trailing slash.

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.

Is the basis for: user_trailingslashit()
Works based on: untrailingslashit()

No Hooks.

Return

String. String with trailing slash added.

Usage

trailingslashit( $string );
$string(string) (required)
What to add the trailing slash to.

Code of trailingslashit: wp-includes/formatting.php VER 5.0.1

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

Related Functions

From category: Formatting

No comments
    Hello, !     Log In . Register