From 0847fab645641702cd4f4fc1d0f893785062a270 Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Sat, 21 Oct 2017 13:27:48 +0000 Subject: [PATCH] Media: Don't backdate media uploaded to pages. When media is uploaded to a post, the upload directory is set according to the date of the post, so that the media URLs in the post match when the post was published. A page is a slightly different beast, pages often live for years, and are regularly updated to stay relevant. This change causes media uploaded to pages to use the upload date to determine the upload directory. Fixes #10752. Built from https://develop.svn.wordpress.org/trunk@41964 git-svn-id: http://core.svn.wordpress.org/trunk@41798 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/media.php | 3 ++- wp-includes/version.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index f60fd6bd82..2ee607d2d5 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -274,7 +274,8 @@ function media_handle_upload($file_id, $post_id, $post_data = array(), $override $time = current_time('mysql'); if ( $post = get_post($post_id) ) { - if ( substr( $post->post_date, 0, 4 ) > 0 ) + // The post date doesn't usually matter for pages, so don't backdate this upload. + if ( 'page' !== $post->post_type && substr( $post->post_date, 0, 4 ) > 0 ) $time = $post->post_date; } diff --git a/wp-includes/version.php b/wp-includes/version.php index 714d5c0f0d..1e09dd949e 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.9-beta3-41963'; +$wp_version = '4.9-beta3-41964'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.