[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:16:33 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  |     Focuses:  performance
-------------------------------------+--------------------------

Comment (by flixos90):

 I think both this ticket and #59224 can quite reasonably be fixed, so I
 don't think a revert is appropriate here. This was indeed a notable
 oversight on the original commit, but that doesn't mean we can't fix it.

 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).

 Looking at the two lists, I don't think any of the values is truly
 unsupported by `WP_Query`, it's more about adjusting the names, for
 example `post_modified_gmt` and `modified_gmt` should map to `modified` so
 that it works in `WP_Query` (the GMT value will be sorted just the same as
 the non-GMT value since they are just in a different timezone). It's
 trivial to add such logic, so let's do it for all previously supported
 orderby fields.

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


More information about the wp-trac mailing list