Avoid removing duplicate posts

I have an arrays of IDs which may contain duplicate values.

Array
(
[0] => 24
[1] => 11
[2] => 60
[3] => 11
)

I’d like to loop through those IDs using WP Query and the post__in property.

Array
(
‘post__in’ => $posts,
‘post_type’ => ‘any,
‘orderby’ => ‘post__in’
)

Everything work as expected, but duplicate IDs are removed by default.
Is there any way to prevent it?

Read more here:: Avoid removing duplicate posts

Leave a Reply

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