Closed ben-milkshake closed 4 years ago
That's not how mysql works, as your query will just include posts that are in this categories (and it doesn't care about their taxonomy order). You will have to do custom query like (pseudocode):
SELECT * FROM wp_posts
JOIN wp_term_taxonomy
GROUP BY (p.ID)
ORDER BY wp_term_taxonomy.order
This code should give you directions on how to progress.
@maciekpaprocki is correct. The order parameter could now live in term meta, but that would include a somewhat relatively expensive LEFT JOIN
on meta_value
which I'd rather avoid.
Hi all, thank you for the great plugin I do have custom posts and I need to make it work with custom categories this doesn't work ` $params = array( 'post_type' => 'mycustompost', 'posts_per_page' => 9999 //'orderby' => array('date' => 'ASC', 'meta_value' => 'ASC') );
$res = new WP_Query($params);` how can I add something that the filter works ? thank you
best