post__in key to get posts from the specific post ids and order
order posts by the other array specific post ids.
I have following:
$post_ids=array(100,200,300,400,500,600,700,800,900,1000); $orderby_post_ids = array(300,800,500); //$order=Ascending/ Descending;
Ascending order, expected output should be like this,
Descending order, expecting output should be like this,
How do I achieve above result using
WP_Query? I used below arguments, but the result is not as expected.
$args = array( 'post_type' => 'mycourses', 'posts_per_page' => 4, 'orderby' => 'post__in', 'order' => 'ASC', 'post__in' => $post_ids, );