[wp-trac] [WordPress Trac] #21987: function get_post_time - if gmt (unset)
WordPress Trac
wp-trac at lists.automattic.com
Fri Oct 5 11:24:44 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 |
-------------------------------------+------------------------------
Changes (by Whissi):
* cc: Whissi (added)
Comment:
I think you are fixing the problem in the wrong function. The root problem
is, that some methods like get_post_time rely on a set post_date_gmt
value. But this value isn't set on non-published items.
So I think we should fix it in WP_Post class in the get_posts() method in
wp-includes/query.php at line ~2691:
{{{
else {
$this->is_preview = true;
if ( 'future' != $status )
$this->posts[0]->post_date = current_time('mysql');
}
}}}
should be
{{{
else {
$this->is_preview = true;
if ( 'future' != $status ) {
$this->posts[0]->post_date = current_time('mysql');
$this->posts[0]->post_date_gmt = current_time('mysql');
}
}
}}}
So every function/method relying on post_date_gmt will now work with
drafts.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/21987#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list