[wp-trac] [WordPress Trac] #35874: XMLRPC: Draft posts are published immediately when changed to published and future-dated at once

WordPress Trac noreply at wordpress.org
Fri Feb 19 18:32:05 UTC 2016


#35874: XMLRPC: Draft posts are published immediately when changed to published and
future-dated at once
--------------------------+------------------------------
 Reporter:  redsweater    |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  XML-RPC       |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by redsweater):

 It's all a little messy in this date logic. Previously in the function
 there is a block of code that derives the $post_date, but it has an
 outdated comment about ignoring draft and pending posts:

 {{{
 /*
  * 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.
  */
 if ( empty( $postarr['post_date'] ) || '0000-00-00 00:00:00' ==
 $postarr['post_date'] ) {
         if ( empty( $postarr['post_date_gmt'] ) || '0000-00-00 00:00:00'
 == $postarr['post_date_gmt'] ) {
                 $post_date = current_time( 'mysql' );
         } else {
                 $post_date = get_date_from_gmt( $postarr['post_date_gmt']
 );
         }
 } else {
         $post_date = $postarr['post_date'];
 }
 }}}

 The fact that $post_date and $post_date_gmt variables are derived in this
 function makes it a little hard to wrap head around. Currently the date
 handling is mostly standardized around converting everything to
 $post_date, but then some dependencies on a GMT version of the date are
 intermingled.

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


More information about the wp-trac mailing list