Ticket #6762: upload_no_subdirs.patch

File upload_no_subdirs.patch, 0.8 kB (added by simonwheatley, 6 months ago)

Amend upload_no_subdirs to allow it to return without date sub directories by passing an argument

  • site/wp-includes/functions.php

    old new  
    10761076} 
    10771077 
    10781078// Returns an array containing the current upload directory's path and url, or an error message. 
    1079 function wp_upload_dir( $time = NULL ) { 
     1079function wp_upload_dir( $time = NULL, $date_subdirs = true ) { 
    10801080        $siteurl = get_option( 'siteurl' ); 
    10811081        $upload_path = get_option( 'upload_path' ); 
    10821082        if ( trim($upload_path) === '' ) 
     
    10961096        } 
    10971097 
    10981098        $subdir = ''; 
    1099         if ( get_option( 'uploads_use_yearmonth_folders' ) ) { 
     1099        if ( get_option( 'uploads_use_yearmonth_folders' ) && $date_subdirs ) { 
    11001100                // Generate the yearly and monthly dirs 
    11011101                if ( !$time ) 
    11021102                        $time = current_time( 'mysql' );