I used 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:
$orderby_post_ids = array(300,800,500);
If it Ascending order, expected output should be like this,
If it 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,
Thanks in advance.
Read more here:: WP_Query Order by array specific post ids