path_join() WordPress Function
The path_join() function is used to join two or more path segments together. It takes an arbitrary number of parameters and returns a single string.
path_join( string $base, string $path ) #
Join 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
function path_join( $base, $path ) { if ( path_is_absolute( $path ) ) { return $path; } return rtrim( $base, '/' ) . '/' . ltrim( $path, '/' ); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
2.5.0 | Introduced. |