Hello.

I have an array with id posts. In it, the id is located exactly in the order I need it. When an array is passed to WP_Query, posts are displayed in their own order. How to make order, as I have in the array? Here is the code:

$recent = new WP_Query(['post__in' => $all_popular, 'orderby' => 'ID', 'order' => 'ASC']); 

Thank.

    1 answer 1

    The order must be post__in

     $recent = new WP_Query(['post__in' => $all_popular, 'orderby' => 'post__in', 'order' => 'ASC']); 
    • It worked. I did not know that it was possible to transmit so. Thank you)) - LexXy