Make WordPress Core

Ticket #15946: 15946.diff

File 15946.diff, 1.2 KB (added by kawauso, 14 years ago)

Generate post date from GMT if present and remove redundant part of if() clause

  • post.php

     
    24582458                $post_name = sanitize_title($post_name);
    24592459        }
    24602460
    2461         // If the post date is empty (due to having been new or a draft) and status is not 'draft' or 'pending', set date to now
    2462         if ( empty($post_date) || '0000-00-00 00:00:00' == $post_date )
    2463                 $post_date = current_time('mysql');
     2461        // If the post date is empty, set date to now or from GMT if available
     2462        if ( empty($post_date) || '0000-00-00 00:00:00' == $post_date ) {
     2463                if ( empty($post_date_gmt) || '0000-00-00 00:00:00' == $post_date_gmt )
     2464                        $post_date = current_time('mysql');
     2465                else
     2466                        $post_date = get_date_from_gmt($post_date_gmt);
     2467        }
    24642468
    24652469        if ( empty($post_date_gmt) || '0000-00-00 00:00:00' == $post_date_gmt ) {
    24662470                if ( !in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) )
     
    24692473                        $post_date_gmt = '0000-00-00 00:00:00';
    24702474        }
    24712475
    2472         if ( $update || '0000-00-00 00:00:00' == $post_date ) {
     2476        if ( $update ) {
    24732477                $post_modified     = current_time( 'mysql' );
    24742478                $post_modified_gmt = current_time( 'mysql', 1 );
    24752479        } else {