[wp-trac] [WordPress Trac] #8885: get_posts() should default orderby post_date_gmt

WordPress Trac wp-trac at lists.automattic.com
Wed Apr 27 17:40:38 UTC 2011

#8885: get_posts() should default orderby post_date_gmt
 Reporter:  caorongjin               |       Owner:  anonymous
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  Future Release
Component:  Optimization             |     Version:  2.7
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |

Comment (by lloydbudd):

 Replying to [ticket:8885 caorongjin]:
 > the function get_posts() in posts.php is defaulted to orderby post_date.
 The problem with this is if entries are added in differing timezones
 (e.g., I changed my system timezone after x number of posts have been
 made), then the sorting is incorrect.  Since post_date_gmt is correct
 despite the timezone you are in, sorting based on this should be the
 default behavior.

 Each approach has its own problems.

 The problem with the proposed solution is that the posts are no longer
 ordered by the displayed date.

 "Fixing" the ordering with the resulting problem of the proposed solution
 is not obvious, particularly if you add multiple users and importantly
 scheduled posts. Imagine an admin changing the timezone info and then an
 editor trying to figure out what is going on.

 The current problem is obvious to solve, the posts are displayed ordered
 by the displayed date.

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

More information about the wp-trac mailing list