You can iterate over the array of IDs and look for the corresponding post in your results to generate output with duplicate posts:
$post_ids = array( 208, 212, 218, 208, 212, 218 );
$args = array(
'post_type' => 'custom_posttyp',
'order_by' => 'post__in',
'post__in' => $post_ids,
);
$the_posts = get_posts( $args );
foreach( $post_ids as $id ){
foreach( $the_posts as $a_post ){
if( $id == $a_post->ID ){
echo get_the_title( $a_post );
}
}
}
Related Posts:
- Pagination not working with custom loop
- Get the ID of the latest post
- Sort custom post type list table by display name of a user id stored as post meta value
- How to use a custom post type as front page?
- Random post, once per day
- get attachments for all posts of particular post type
- Query custom post type by custom field
- Add Custom Post Type to Current Query
- Custom Queries: Joining On Meta Values From Two Custom Post Types
- SQL to update custom post taxonomies
- Query multiple taxonomy in Custom Post Type
- Querying Posts by Taxonomy From Alternate Network Site
- Custom Search | Wrong output & question
- Get the most popular terms for a custom post type
- Query by 2 values of a repeater ACF field
- show posts only on homepage but using custom post type and taxonomy for query posts via url
- Comparing timestamps in meta query doesn’t work
- Display two post types ordered by two custom fields
- WP insert post PHP function dynamically generated Custom Fields
- Include both default and Custom Post Type in query modified inside pre_get_posts
- Query posts between two dates (custom meta keys) CMB2
- $wpdb returns no results with SELECT query on custom post type, works on default post type
- Include different loop templates in search query
- Adding posts of custom type into the main feed
- Custom Post Types, Page Templates and Pagination. Why do I get a 404 Error?
- Inserting data into `post meta` table?
- Custom Select Query with Custom Post Types
- Automatically adding meta data to posts or multiple query help
- Having trouble with custom date field for CPT query (WordPress)
- Custom Post Type order by modified date and custom meta field issue
- Sort posts based on multiple custom fields
- WP_Query search posts by custom post type and custom taxonomy
- Calculating Bayesian average for custom post type
- Conditional to modify query results
- Is it possible to create a shortcode that will query a post based on taxonomies?
- Selecting New & Edit Page for Custom Post Types
- Show Two custom Post type and their posts on category page
- How to filter custom taxonomy categories on archive?
- Modifying date filter on admin page for custom post type to link to custom field
- Ignore sticky posts if post is not in meta query
- Querying Term Posts in Loop
- How to debug a blank page?
- query posts and custom post type with meta key
- Use get_post_types to query only custom posts types
- WordPress Orderby Numeric Value Not Working
- Query string parameters from custom fields, inconsistent results
- Custom Post type is being ignored in query
- Query custom post type only if it contains another custom post type
- Add post_type to index.php
- Order By Post Type ThenBy Taxonomy
- Custom query to filter posts that have current post as a taxonomy [closed]
- Am unable to reset a query properly
- Custom post type redirected to homepage – how to debug
- How to modify archive query with pre_get_posts to append CPTs?
- Get next and previous 3 posts in a term in single post page
- convert custom query to wp_query
- Making certain categories of CPT not publicly queryable
- Search / Filter posts on Title/Content OR Tags
- Get parse_query filter to return slug instead of id
- Querying both pages and posts
- Meta query for custom post type ignored in main query
- Querying Two Custom Post Types with OR Not Working
- How do I move/order posts with a tag to the end?
- creat filter with wp_query
- Specific query for custom post type
- Display post content with respect to its title?
- First custom field value (out of several) displayed twice after query
- Prioritize posts in query by meta keys?
- What’s the equivalent of Hide From Menus on MODX on WordPress?
- WP_Query orderby and tax_query
- I am trying to hide a custom post type category to logged in users with Pre_Get_Posts
- Filter CPT based on meta box value using Flexible Posts widget?
- WordPress can only query up to 766
- How would I get a list of posts from a custom post type
- Pagination not working with custom loop
- Pagination not working with custom loop
- Post content stays the same but permalink changes ?
- Pagination not working with custom loop
- Retrieve post data via WPDB class
- $wpdb returns no results with SELECT query on custom post type, works on default post type
- Listing custom post type items from a couple of custom taxonomies
- Pagination not working with custom loop
- Show custom posts with a specific “custom TAXONOMY slug” on startpage
- How to grab data (titles, thumbnails and custom fields) from multiple posts to populate a new array efficiently?
- Allow admin to determine the order of queries?
- WordPress search results
- Posts 2 Posts: query connected — orderby problem
- Code in custom widget queries all posts, when it should only query the current post
- custom post-type query just returns two posts
- Order custom post type is beign ignored
- How to add post type in masonry posts elementory widget
- Filter Custom post type by another Custom post type
- Create a list of months based posts
- WordPress Admin Page Slow. Customer Post Type is the slowest
- Add a class to a menu item depending on a body class
- Get Posts ordered by a date custom meta field
- Display all child posts in a custom post type, grouped by a custom taxonomy site
- Load posts via AJAX without draft status
- How can I show a field ID in Elementor with Request Parameter
- Query Multiple Post Types and Paginate Newly Created List