[wp-trac] [WordPress Trac] #31265: Metadata 'orderby' parity across query classes

WordPress Trac noreply at wordpress.org
Sun Feb 8 17:21:03 UTC 2015


#31265: Metadata 'orderby' parity across query classes
----------------------------+-----------------------------
 Reporter:  boonebgorges    |       Owner:
     Type:  task (blessed)  |      Status:  new
 Priority:  normal          |   Milestone:  Future Release
Component:  Query           |     Version:
 Severity:  normal          |  Resolution:
 Keywords:  needs-patch     |     Focuses:
----------------------------+-----------------------------
Description changed by SergeyBiryukov:

Old description:

> `WP_Query`, `WP_User_Query`, and `WP_Comment_Query` all have some support
> for ordering results by metadata (postmeta, usermeta, or commentmeta).
> But the support is inconsistent. `WP_Query` should be the reference, and
> we should sweep through `WP_User_Query` and `WP_Comment_Query` to ensure
> that they're up to snuff. Things to check:
>
> - 'orderby' should accept space-separated values (`'orderby' =>
> 'comment_user_ID comment_ID'`) as well as the array syntax introduced to
> `WP_Query` in #17065. See #30478.
> - `meta_value`, `meta_key`, `meta_type`, and `meta_compare` should all be
> supported, and should be translated to a `meta_query` clause in the same
> way (using `WP_Meta_Query::parse_query_vars()`, I suppose)
> - 'orderby=meta_value`, `orderby=meta_value_num`, and `orderby=somekey`
> when `meta_key=somekey` should be supported. See #27887.
> - `orderby=clausename`, where 'clausename' is the array-key identifier of
> a `meta_query` clause. See #31045 for how this was done in `WP_Query`.
>
> Some of this is done, some is definitely not, some I'm too lazy to check
> at the moment. All of it needs unit tests.

New description:

 `WP_Query`, `WP_User_Query`, and `WP_Comment_Query` all have some support
 for ordering results by metadata (postmeta, usermeta, or commentmeta). But
 the support is inconsistent. `WP_Query` should be the reference, and we
 should sweep through `WP_User_Query` and `WP_Comment_Query` to ensure that
 they're up to snuff. Things to check:

 - 'orderby' should accept space-separated values (`'orderby' =>
 'comment_user_ID comment_ID'`) as well as the array syntax introduced to
 `WP_Query` in #17065. See #30478.
 - `meta_value`, `meta_key`, `meta_type`, and `meta_compare` should all be
 supported, and should be translated to a `meta_query` clause in the same
 way (using `WP_Meta_Query::parse_query_vars()`, I suppose)
 - `orderby=meta_value`, `orderby=meta_value_num`, and `orderby=somekey`
 when `meta_key=somekey` should be supported. See #27887.
 - `orderby=clausename`, where 'clausename' is the array-key identifier of
 a `meta_query` clause. See #31045 for how this was done in `WP_Query`.

 Some of this is done, some is definitely not, some I'm too lazy to check
 at the moment. All of it needs unit tests.

--

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


More information about the wp-trac mailing list