Get WP_Query to return duplicate posts
-
Howdie,
I cannot for my life figure out how to get wordpress to return duplicate posts using WP_Query. It always removes the duplicate post. Im getting the posts by id’s. Within an array there may be multiple duplicate id’s. I need to do this to display the same post twice within a loop because they have different meta values. Here is my code:
$post_ids = array(10, 245, 78, 15, 245, 10); //something like that 245 is in there twice. $args = array( 'post__in' => $post_ids, 'post_type' => 'sfd_products' ); $the_query = new WP_Query($args); while ($the_query->have_posts()) : $the_query->the_post(); //post stuff endwhile;
Everything works correctly, but postid 245 only shows once. I want it to loop twice. Is this possible? The only other way I can think is make multiple queries with smaller chunks of arrays that do not have duplicates. I really don’t want to go that route.
Thanks in advance.
- The topic ‘Get WP_Query to return duplicate posts’ is closed to new replies.