path_join( string $base, string $path )

Join two filesystem paths together.


Description Description

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


Parameters Parameters

$base

(string) (Required) Base path.

$path

(string) (Required) Path relative to $base.


Top ↑

Return Return

(string) The path with the base or absolute path.


Top ↑

Source Source

File: wp-includes/functions.php

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

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

Top ↑

Changelog Changelog

Changelog
Version Description
2.5.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

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