WP Query and order by particular specified IDs
To keep the same post order as it was passed to the post__in parameter, you need to pass post__in as value to orderby argument and ASC to the order argument $query_args = [ ‘posts_per_page’ => $products, ‘no_found_rows’ => true, ‘post_type’ => ‘product’, ‘post__in’ => [161,165,131,202], ‘orderby’ => ‘post__in’, ‘order’ => ‘ASC’ ]; EDIT Looking at … Read more