WP_Query ordering insufficient, how to extend the SQL?
-
I have a WP_Query followed by a loop through the provided results. The SQL the query runs looks like this:
SELECT SQL_CALC_FOUND_ROWS xyz_posts.ID FROM xyz_posts INNER JOIN xyz_term_relationships ON (xyz_posts.ID = xyz_term_relationships.object_id) WHERE 1=1 AND ( xyz_term_relationships.term_taxonomy_id IN (2) ) AND xyz_posts.post_type = 'some_tax' AND (xyz_posts.post_status = 'publish') GROUP BY xyz_posts.ID ORDER BY xyz_posts.menu_order DESC LIMIT 6, 6
This is insufficient in my case. I need to extend the ORDER BY clause like this:
ORDER BY xyz_posts.menu_order DESC, xyz_posts.ID
I don’t think there’s a way to add that to the SQL via WP_Query arguments.
How do I go about solving this?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘WP_Query ordering insufficient, how to extend the SQL?’ is closed to new replies.