[wp-trac] [WordPress Trac] #21987: function get_post_time - if gmt (unset)

WordPress Trac noreply at wordpress.org
Wed Dec 5 07:10:55 UTC 2012

#21987: function get_post_time -  if gmt  (unset)
 Reporter:  soficgr                  |       Owner:
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  Awaiting Review
Component:  Date/Time                |     Version:
 Severity:  minor                    |  Resolution:
 Keywords:  has-patch needs-testing  |

Comment (by soficgr):

 sorry for my late answer (work)

 The problem starts here wordpress\wp-includes\post.php

 function wp_insert_post ... (at line 2789)

         // 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($post_date) || '0000-00-00 00:00:00' == $post_date )
                 $post_date = current_time('mysql');

 is not set and gmt date time. also same file at line :2802

         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);
                         $post_date_gmt = '0000-00-00 00:00:00';

 if the post status is 'draft', 'pending', 'auto-draft' has not gtm time
 but this use for wp as default and i think it is difficult to change this.
 This will create many compatibility problems if change. I'm not sure why
 they did this all type have status (not need to check for the gmt) but at
 several points wp check for this.

 For example if the is not set gtm wp "now" the post is not publish but the
 post have status and can "now" this without gmt check. but this does :\

 I gave one easy fix for the display problem ... but is true the problem is
 all this code who checks for gmt and not for status.

 why the not publish types don't have gtm time? xmmm

Ticket URL: <http://core.trac.wordpress.org/ticket/21987#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software

More information about the wp-trac mailing list