#24133 closed defect (bug) (duplicate)
WP_Query, multiple 'orderby' values glitch
| Reported by: | racura | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Query | Version: | 3.5.1 |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
Description (last modified by )
According to the documentation, WP_Query argument 'orderby' allows for multiple values, but it doesn't work.
Looking in the code i found out why, the 'order' is only being applied to the last item in the list.
So for instance:
('orderby' => 'title menu_order', 'order' => 'DESC')
Will end up as
"ORDER BY $wpdb->posts.menu_order, $wpdb->posts.post_menu_order DESC"
To fix (I hope), the following needs to be done to query.php line 2387
$orderby_array[] = $orderby.' '.$q['order'];
Change History (5)
This ticket was mentioned in IRC in #wordpress-dev by SergeyBiryukov. View the logs.
12 years ago
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Sorry, the code fix should be:
And remove lines 2393 and 2394