path_join
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.
Returns (string)
The path with the base or absolute path.
Parameters (2)
- 0. $base (string)
- Base path.
- 1. $path (string)
- Path relative to
$base
.
Usage
if ( !function_exists( 'path_join' ) ) { require_once ABSPATH . WPINC . '/functions.php'; } // Base path. $base = ''; // Path relative to $base. $path = ''; // NOTICE! Understand what this does before running. $result = path_join($base, $path);
Defined (1)
The function is defined in the following location(s).
- /wp-includes/functions.php
- function path_join( $base, $path ) {
- if ( path_is_absolute($path) )
- return $path;
- return rtrim($base, '/') . '/' . ltrim($path, '/');
- }