Order posts by specific post IDs

I have the following code:

$viewed_products = [3358, 3296, 3929, 3368];

$query_args = array(
‘posts_per_page’ => 4,
‘no_found_rows’ => 1,
‘post_status’ => ‘publish’,
‘post_type’ => ‘product’,
‘post__in’ => $viewed_products,
‘orderby’ => ‘post__in’,
);

but it gets following sorting:
3929, 3368, 3358, 3296

Is there anything I’m doing wrong?

Read more here:: Order posts by specific post IDs

Leave a Reply

Your email address will not be published. Required fields are marked *