WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/21/2017 01:26:24 PM (3 years ago)
Author:
pento
Message:

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.

File:
1 edited

Legend:

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

    r41746 r41964  
    275275    $time = current_time('mysql');
    276276    if ( $post = get_post($post_id) ) {
    277         if ( substr( $post->post_date, 0, 4 ) > 0 )
     277        // The post date doesn't usually matter for pages, so don't backdate this upload.
     278        if ( 'page' !== $post->post_type && substr( $post->post_date, 0, 4 ) > 0 )
    278279            $time = $post->post_date;
    279280    }
Note: See TracChangeset for help on using the changeset viewer.