Independent ASC/DESC in multiple ORDER BY statement.
|Reported by:||ericmann||Owned by:||ericmann|
WP_Query supports ordering results by multiple columns, but does not currently support independent ASC/DESC declarations on those columns. Instead, it concatenates the ORDER and ORDER BY statements together.
In some cases, it would be beneficial to independently set the order for these columns. An example offered on WP-Hackers:
I have a situation where I want to order a list of post both by author and date using WP_Query which isn't a problem since 'orderby' lets me do that. But I want the author part sorted ascending and date part sorted descending.
A normal MySql statement would end with ORDER BY author ASC, date DESC.
We should extend WP_Query to allow users to set their ordering parameters independently. This should be done in such a way as to not break backwards compatibility.
Change History (85)
4 years ago
- Cc rosariobocca added
- Type changed from enhancement to feature request
- Keywords needs-unit-tests added
- Type changed from feature request to enhancement
This ticket was mentioned in IRC in #wordpress-dev by SergeyBiryukov_. View the logs.
21 months ago
- Resolution set to fixed
- Status changed from new to closed
- Type changed from enhancement to task (blessed)