[wp-trac] [WordPress Trac] #27578: Editing a draft does not set `post_date_gmt`, but quick editing a draft does

WordPress Trac noreply at wordpress.org
Sat Mar 29 08:41:36 UTC 2014


#27578: Editing a draft does not set `post_date_gmt`, but quick editing a draft
does
-------------------------------+------------------------------
 Reporter:  Denis-de-Bernardy  |       Owner:
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Posts, Post Types  |     Version:  trunk
 Severity:  normal             |  Resolution:
 Keywords:                     |     Focuses:  administration
-------------------------------+------------------------------

Comment (by Denis-de-Bernardy):

 I *think* the fix to all of these is to change the following in
 `wp_insert_post()`:

 {{{
         if ( empty($post_date_gmt) || '0000-00-00 00:00:00' ==
 $post_date_gmt ) {
                 if ( !in_array( $post_status, array( 'draft', 'pending',
 'auto-draft' ) ) )
                         $post_date_gmt = get_gmt_from_date($post_date);
                 else
                         $post_date_gmt = '0000-00-00 00:00:00';
         }
 }}}

 To:

 {{{
         if ( empty($post_date_gmt) || '0000-00-00 00:00:00' ==
 $post_date_gmt ) {
                 if ( !in_array( $post_status, array( 'draft', 'pending',
 'auto-draft' ) ) )
                         $post_date_gmt = get_gmt_from_date($post_date);
                 else
                         $post_date_gmt = '0000-00-00 00:00:00';
         }
         elseif ( in_array( $post_status, array( 'draft', 'pending', 'auto-
 draft' ) ) ) {
                 $post_date_gmt = '0000-00-00 00:00:00';
         }
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/27578#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list