Make WordPress Core


Ignore:
Timestamp:
10/02/2015 04:35:34 AM (10 years ago)
Author:
wonderboymusic
Message:

Posts: In wp_insert_post(), don't set post_date to current time if it can be derived from a passed value for post_date_gmt.

Adds unit tests.

Props oso96_2000, kawauso.
Fixes #15946.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/post-functions.php

    r34746 r34762  
    30133013     */
    30143014    if ( empty( $postarr['post_date'] ) || '0000-00-00 00:00:00' == $postarr['post_date'] ) {
    3015         $post_date = current_time( 'mysql' );
     3015        if ( empty( $postarr['post_date_gmt'] ) || '0000-00-00 00:00:00' == $postarr['post_date_gmt'] ) {
     3016            $post_date = current_time( 'mysql' );
     3017        } else {
     3018            $post_date = get_date_from_gmt( $postarr['post_date_gmt'] );
     3019        }
    30163020    } else {
    30173021        $post_date = $postarr['post_date'];
Note: See TracChangeset for help on using the changeset viewer.