On this page
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
$basestring Required-
Base path.
$pathstring 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;
}
Related
Uses
| Uses | Description |
|---|---|
| path_is_absolute() wp-includes/functions.php | Tests if a given filesystem path is absolute. |
Used By
| Used By | Description |
|---|---|
| wp_get_original_image_path() wp-includes/post.php | Retrieves the path to an uploaded image file. |
| wp_get_original_image_url() wp-includes/post.php | Retrieves the URL to an original attachment image. |
| wp_delete_attachment_files() wp-includes/post.php | Deletes all files that belong to the given attachment. |
| _wp_upload_dir() wp-includes/functions.php | A non-filtered, non-cached version of wp_upload_dir() that doesn’t check the path. |
| wp_restore_image() wp-admin/includes/image-edit.php | Restores the metadata for a given attachment. |
| wp_save_image() wp-admin/includes/image-edit.php | Saves image to post, along with enqueued changes in |
| WP_Filesystem_Base::search_for_folder() wp-admin/includes/class-wp-filesystem-base.php | Locates a folder on the remote filesystem. |
| _load_image_to_edit_path() wp-admin/includes/image.php | Retrieves the path or URL of an attachment’s attached file. |
| image_get_intermediate_size() wp-includes/media.php | Retrieves the image’s intermediate size (resized) path, width, and height. |
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