Make WordPress Core


Ignore:
Timestamp:
10/03/2012 06:49:37 PM (12 years ago)
Author:
nacin
Message:

Pass the post date to wp_upload_dir() during sideloads, just as we do uploads. Ensures that sideloaded images make it into the right uploads directory.

props solarisssmoke, fixes #16777.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/media.php

    r22093 r22105  
    270270    $overrides = array('test_form'=>false);
    271271
    272     $file = wp_handle_sideload($file_array, $overrides);
     272    $time = current_time( 'mysql' );
     273    if ( $post = get_post( $post_id ) ) {
     274        if ( substr( $post->post_date, 0, 4 ) > 0 )
     275            $time = $post->post_date;
     276    }
     277
     278    $file = wp_handle_sideload( $file_array, $overrides, $time );
    273279    if ( isset($file['error']) )
    274280        return new WP_Error( 'upload_error', $file['error'] );
Note: See TracChangeset for help on using the changeset viewer.