I'm trying to merge 2 WP_Query in a new WP_Query and then order all posts in this new merged query by date descending. I can merge 2 WP_Query and work fine, but I can't order the new query
$args1 = array(
'posts_per_page' => '10',
'post_status' => 'publish',
'post_type' => array('news','partners'),
'orderby' => 'date',
'order' => 'DESC'
);
$queried_post1 = new WP_Query($args1);
$args2 = array(
'posts_per_page' => '10',
'post_status' => 'publish',
'post_type' => array('post'),
'orderby' => 'date',
'order' => 'DESC',
'tax_query' => array(array(
'taxonomy' => 'tax',
'field' => 'id',
'terms' => '5'
))
);
$queried_post2 = new WP_Query($args2);
$merged_queried_post = new WP_Query();
$merged_queried_post->posts = array_merge($queried_post1->posts,$queried_post2->posts);
$merged_queried_post->post_count = $queried_post1->post_count + $queried_post2->post_count;
In this point, I need to order all posts in $merged_queried_post by date.
Thanks for help