[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:27:04 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 azaozz):
* keywords: 2nd-opinion needs-patch => 2nd-opinion needs-patch needs-unit-
tests
Comment:
Replying to [comment:8 flixos90]:
> I think both this ticket and #59224 can quite reasonably be fixed, so I
don't think a revert is appropriate here.
> ...
> 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).
Yep, a "translation layer" would probably work. But wouldn't adding that
layer basically mean the old code is recreated so the refactoring is
totally useless? That will likely negate any minuscule speed improvements
that were gained from that refactoring, and at the same time might still
miss other possible regressions.
> 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.
Sure, sounds like that'd work for fixing the `orderby`. If you think it is
better to keep fixing back-compat problems, the new code will also need
all possible tests to confirm old functionality and quirks are still
supported.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59226#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list