[wp-trac] [WordPress Trac] #42907: Meta Queries: support ordering by meta_value but still including items without that key

WordPress Trac noreply at wordpress.org
Thu Dec 14 22:07:55 UTC 2017


#42907: Meta Queries: support ordering by meta_value but still including items
without that key
-------------------------+------------------------------
 Reporter:  jdgrimes     |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Query        |     Version:  trunk
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:
-------------------------+------------------------------

Comment (by jdgrimes):

 [attachment:42907.diff] is an initial patch. It makes the necessary
 updates to `WP_Meta_Query`, with some unit tests. It also updates the
 order by handing of `WP_Query`. [attachment:scratch_69.php] is some basic
 tests involving `WP_Query` that demonstrate what the patch makes possible.
 (These tests pass with the patch applied, BTW.)

 I would really like to see this kind of handling in other query classes
 too though, not just `WP_Query`. (In particular, I was actually looking
 for something like this for `WP_User_Query`.) Ideally though, it seems
 like the order by handling should be centralized, or at least the part
 relating to meta queries. Possibly there are already tickets for that
 even, I haven't checked yet.

 Mostly curious whether this is an enhancement that would be considered,
 before I proceed further, or whether this is too specialized a use-case to
 warrant handling for it being built-in.

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


More information about the wp-trac mailing list