wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren
_wp_relative_upload_path is private and should not be used in themes or plugins directly.
_wp_relative_upload_path › WordPress Function
Seit2.9.0
Veraltetn/v
› _wp_relative_upload_path ( $path )
| Zugriff: |
|
| Parameter: |
|
| Gibt zurück: |
|
| Definiert in: |
|
| Codex: |
Returns relative path to an uploaded file.
The path is relative to the current upload dir.Ähnliche Funktionen: _wp_translate_postdata, wp_resolve_post_date, _wp_handle_upload, wp_get_upload_dir, _wp_get_attachment_relative_path
Quellcode
function _wp_relative_upload_path( $path ) {
$new_path = $path;
$uploads = wp_get_upload_dir();
if ( str_starts_with( $new_path, $uploads['basedir'] ) ) {
$new_path = str_replace( $uploads['basedir'], '', $new_path );
$new_path = ltrim( $new_path, '/' );
}
/**
* Filters the relative path to an uploaded file.
*
* @since 2.9.0
*
* @param string $new_path Relative path to the file.
* @param string $path Full path to the file.
*/
return apply_filters( '_wp_relative_upload_path', $new_path, $path );
}