[wp-trac] [WordPress Trac] #59226: get_pages: post_modified_gmt value for sort_column/orderby silently dropped

WordPress Trac noreply at wordpress.org
Tue Aug 29 16:51:17 UTC 2023


#59226: get_pages: post_modified_gmt value for sort_column/orderby silently dropped
-------------------------------------------------+-------------------------
 Reporter:  david.binda                          |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  6.3.2
Component:  Posts, Post Types                    |     Version:  6.3
 Severity:  normal                               |  Resolution:
 Keywords:  2nd-opinion needs-patch needs-unit-  |     Focuses:
  tests                                          |  performance
-------------------------------------------------+-------------------------
Changes (by david.binda):

 * keywords:  2nd-opinion has-patch has-unit-tests => 2nd-opinion needs-
     patch needs-unit-tests


Comment:

 Replying to [comment:8 flixos90]:

 > I think we'll need to add "translation layer" logic into `get_pages()`,
 to ensure that all the orderby values which were supported by
 `get_pages()` but aren't supported by `WP_Query` are properly translated
 (`post_modified_gmt` is not the only one as far as I can tell).

 When opening the ticket, I have specifically checked whether there are any
 other orderby params which have been dropped, and the `post_modified_gmt`
 is the only one missing. But might be worth double checking, of course :)

 > the GMT value will be sorted just the same as the non-GMT value since
 they are just in a different timezone

 This is, IMHO, not correct. While the `post_modified_gmt` is always in the
 same no matter what timezone is currently set for the installation, the
 `post_modified` for new post changes whenever installation timezone is
 changed, but older posts are not affected. Thus the `post_modified` can
 differ upon timezone change. Can imagine it leading to issues e.g.: with
 day light saving time or a post published close to each other before and
 after timezone change (the new timezone would need to be further back in
 the offset that the difference in between the time of post published). But
 I must admit that I haven't really tested this.

 That said, I believe that the `post_modified_gmt` orderby should be added
 to `WP_Query` for proper backward compatibility. But I'm not sure why it's
 not there already.

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


More information about the wp-trac mailing list