[wp-trac] [WordPress Trac] #31045: Ordering a Query Using Multiple Meta Keys

WordPress Trac noreply at wordpress.org
Mon Jan 26 18:52:31 UTC 2015


#31045: Ordering a Query Using Multiple Meta Keys
------------------------------------------+-----------------------------
 Reporter:  Funkatronic                   |       Owner:
     Type:  feature request               |      Status:  new
 Priority:  normal                        |   Milestone:  Future Release
Component:  Query                         |     Version:  trunk
 Severity:  normal                        |  Resolution:
 Keywords:  needs-patch needs-unit-tests  |     Focuses:
------------------------------------------+-----------------------------

Comment (by Funkatronic):

 My idea to change `parse_orderby`:
 - Get all aliases, both custom and ones created by `WP_Meta_query`, in
 query
 - Check if `orderby` matches any of the aliases
 - If it matches, create an `ORDER BY` clause that uses that alias:
 `alias.meta_value`

 You don't have to know what the related join clauses contain, just as long
 as you know the alias thats being used for the join, you can use it for
 the `ORDER BY`, at least imho.

 As far as I can tell, `table_aliases` keeps track of all the aliases used,
 though like you said, we need to test to make sure we cover all bases.
 Also, does WP have any sanitation functions for table aliases?

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


More information about the wp-trac mailing list