we added a custom query to our template which works fine. So we want to display all posts out of our array. But if we have some duplicate IDs in our array, WP ignores the duplicated IDs and shows every Posts->ID only once.

$args = array(
'post_type' => "custom_posttyp",
'order_by' => 'post__in',
'post__in'  => $post_ids, // array with (208, 212, 218, 208, 212, 218)
);

So based on this example the while-func just renders 3 posts instead of 6 – we think because of duplicated IDs – but we sometimes have to render also 2 or 3 copies of one post if the array has IDs twice, three times etc.

Any Idea?
Ben

Read more here: new WP_query > displays posts only once instead of running through full array


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: