Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




_wp_relative_upload_path [ WordPress Function ]

_wp_relative_upload_path ( $path )
Parameters:
  • (string) $path Full path to the file
Uses:
Returns:
  • (string) relative path on success, unchanged path on failure.
Defined at:



Return relative path to an uploaded file.

The path is relative to the current upload dir.

Source


<?php
function _wp_relative_upload_path$path ) {
    
$new_path $path;

    if ( (
$uploads wp_upload_dir()) && false === $uploads['error'] ) {
        if ( 
=== 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 );
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics