wordpress / latest / functions / path_join.html

path_join( string $base, string $path ): string

Joins two filesystem paths together.

Description

For example, ‘give me $path relative to $base’. If the $path is absolute, then it the full path is returned.

Parameters

$base string Required
Base path.
$path string Required
Path relative to $base.

Return

string The path with the base or absolute path.

Source

File: wp-includes/functions.php. View all references

function path_join( $base, $path ) {
	if ( path_is_absolute( $path ) ) {
		return $path;
	}

	return rtrim( $base, '/' ) . '/' . $path;
}

Uses

Uses Description

Used By

Used By Description

Changelog

Version Description
2.5.0 Introduced.

© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/path_join