WordPress at a glance

path_join() WP 1.0

Join two filesystem paths together.

For example, 'give me$pathrelative to $base'. If the $path is absolute, then it the full path is returned.

Works based on: path_is_absolute()
✈ 1 time = 0.000061s = very fast | 50000 times = 0.05s = speed of light | PHP 7.1.1, WP 4.7.2

No Hooks.


String. The path with the base or absolute path.


path_join( $base, $path );
$base(string) (required)
Base path.
$path(string) (required)
Path relative to $base.

Code of path join: wp-includes/functions.php VER 5.0.3

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

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

Related Functions

From tag: path (directory folder)

More from category: Helper Functions

No comments
    Hello, !     Log In . Register