Definition:
function _wp_relative_upload_path( $path ) {}
Return relative path to an uploaded file.
The path is relative to the current upload dir.
Parameters
- string $path: Full path to the file
Return values
returns:relative path on success, unchanged path on failure.
Defined filters
- _wp_relative_upload_path
apply_filters( '_wp_relative_upload_path', $new_path, $path )
Source code
function _wp_relative_upload_path( $path ) {
$new_path = $path;
if ( ($uploads = wp_upload_dir()) && false === $uploads['error'] ) {
if ( 0 === strpos($new_path, $uploads['basedir']) ) {
$new_path = str_replace($uploads['basedir'], '', $new_path);
$new_path = ltrim($new_path, '/');
}
}
return apply_filters( '_wp_relative_upload_path', $new_path, $path );
}
4413

February 12, 2011 


No comments yet... Be the first to leave a reply!