[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 18:03:30 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
-------------------------------------------------+-------------------------
Comment (by flixos90):
Replying to [comment:11 david.binda]:
> 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 :)
You're right, it's just that one (plus the unprefixed `modified_gmt`) :)
> > the GMT value will be sorted just the same as the non-GMT value since
they are just in a different timezone
>
> 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.
I am not opposed to this, though I think it would be more appropriate to
implement that as a separate ticket as it would require a bit more effort
and potentially additional discussion. Mapping `modified_gmt` to
`modified` will work in the vast majority of cases, and it's a simple fix
for the root problem (right now the order is completely different, while
when using `modified` it would be the same in most scenarios).
We could first commit this fix, then open another ticket to implement
`post_modified_gmt` support in `WP_Query`, and as part of that ticket
remove the "translation" logic again, thus fixing it in an even better
way. WDYT?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59226#comment:13>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list