From 04ce1eb9501c156c7f5c3f9437113cbf637a388a Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Fri, 14 Nov 2008 03:26:06 +0000 Subject: [PATCH] Fix uploads sub-directory for drafts, props DD32, fixes #8205 git-svn-id: https://develop.svn.wordpress.org/trunk@9675 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/media.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index 0ed8682e48..0aecb080ea 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -173,9 +173,12 @@ win.send_to_editor(''); */ function media_handle_upload($file_id, $post_id, $post_data = array()) { $overrides = array('test_form'=>false); - - $post = get_post($post_id); - $time = $post->post_date_gmt; + + $time = current_time('mysql', true); + if ( $post = get_post($post_id) ) { + if ( substr( $post->post_date, 0, 4 ) > 0 ) + $time = $post->post_date; + } $file = wp_handle_upload($_FILES[$file_id], $overrides, $time);