WordPress.org

Make WordPress Core

Ticket #5698: 5698.diff

File 5698.diff, 1.5 KB (added by ryan, 10 years ago)
  • wp-includes/post.php

     
    13601360        }
    13611361
    13621362        // If the post date is empty (due to having been new or a draft) and status is not 'draft', set date to now
    1363         if ( empty($post_date) || '0000-00-00 00:00:00' == $post_date ) {
    1364                 if ( !in_array($post_status, array('draft', 'pending')) )
    1365                         $post_date = current_time('mysql');
    1366                 else
    1367                         $post_date = '0000-00-00 00:00:00';
    1368         }
     1363        if ( empty($post_date) || '0000-00-00 00:00:00' == $post_date )
     1364                $post_date = current_time('mysql');
    13691365
    13701366        if ( empty($post_date_gmt) || '0000-00-00 00:00:00' == $post_date_gmt ) {
    13711367                if ( !in_array($post_status, array('draft', 'pending')) )
     
    15341530                $post_cats = $post['post_category'];
    15351531
    15361532        // Drafts shouldn't be assigned a date unless explicitly done so by the user
    1537         if ( in_array($post['post_status'], array('draft', 'pending')) && empty($postarr['edit_date']) && empty($postarr['post_date']) &&
    1538                          ('0000-00-00 00:00:00' == $post['post_date']) )
     1533        if ( in_array($post['post_status'], array('draft', 'pending')) && empty($postarr['edit_date']) &&
     1534                         ('0000-00-00 00:00:00' == $post['post_date_gmt']) )
    15391535                $clear_date = true;
    15401536        else
    15411537                $clear_date = false;
     
    15441540        $postarr = array_merge($post, $postarr);
    15451541        $postarr['post_category'] = $post_cats;
    15461542        if ( $clear_date ) {
    1547                 $postarr['post_date'] = '';
     1543                $postarr['post_date'] = current_time('mysql');;
    15481544                $postarr['post_date_gmt'] = '';
    15491545        }
    15501546