Use the proper parameter. Try this:
$post_ids = array( 50, 53, 56, 58 );
$query = new WP_Query('post__in' => $post_ids );
Related Posts:
- Trying to list out child pages with WP_Query
- Display specific page (that is child) content on parent page
- Determine if ID is page or post and query the ID
- Custom query does not find pages
- How to use custom page for all posts with custom url, call another directory?
- display the children of the post using the current page as the main parent
- pages shortcode filtering by category
- Retrieving category pages from subcategory returns empty sets
- Issue in If else condition [closed]
- Some doubts about how the main query and the custom query works in this custom theme?
- Using a custom WP_Query with get_template_part loop
- Loop within a loop?
- How to list some posts first in the loop based on post id
- Display posts the match taxonomy term linked from wp_list_categoies?
- WordPress Custom Query to show posts from last x years
- How to order posts tag by tag?
- Pagination with 5 posts per page
- Merging a complex query with post_rewind and splitting posts into two columns
- Pagination Not working on Home Page with 2 Query
- meta_query not working properly
- Exclude post on loop by multiple meta key value
- Sort by meta key on archive page
- Order by menu structure
- Targeting specific pages in the loop
- What are the differences between “Latest Posts” and “Static Page”?
- Splitting the main query in multiple loops with query_posts and/or pre_get_posts?
- Query sticky posts with thumbnails
- Show all parents and children in custom post type in right order
- Why is this coming back as null? Thats wrong. There is one post
- Ignore post by meta value in the main query
- How to retrieve current page WP_Query arguments?
- WP_Query doesn’t get sticky post at the top, when used in a page template
- How to limit WP_Query to one result on the loop?
- Prevent duplicate post from dynamic multiple loops
- if/else on custom query gives 200 OK when condition not met?
- Multiple Loops Inside a Function
- Sticky posts are not showing at the top of category posts
- Random loop with code to prevent duplicate output returns no output at all from time to time
- How to use offset in WP_Query
- Multiple loops without repeating content
- Can I set my WP_Query to be a Main Query?
- Group and list posts by custom taxonomy
- Filtering posts from different categories into different section by doing WP_Query only once
- Display custom tags on pages that have a specific page parent
- How to get list of posts from permalinks?
- Custom taxonomy.php not working
- different for loop if screen resolution < 1000px
- Transient api Caches confused
- Exclude parent with child pages from WP_Query
- how to use pre_gets_posts to exclude one queried ID from homepage loop
- sort and display posts by custom field (wp-query and the loop))
- Get posts that do not have the same tags as current
- wp_query is showing posts from other categories
- Should I reset $wp_query?
- Exclude a Woocommerce product from WP_Query
- WP_QUERY wrong ammount of posts
- How to add sort order to incremented and paginated category loop
- How does WP generate the default $query in WP_Query based on the URL?
- How to remove only the latest sticky post from the loop
- Expecting statement error from php loop using ACF plugin
- How I can repeat 2 HTML templates in a WordPress Query?
- How do I sort this custom list of sticky posts
- Query only displays one page_id
- Get posts with no tags?
- wp-query, pull children of parent page
- I am officially missing something about transient posts
- Offset WP_Query by negative 1
- WP_Query orderby random do not repeat infinite scroll – one loop
- How do I get the content of a custom instance of WP_Query?
- How to query for a page, get data, then query for child pages of that page
- How to pass the current content of $wp_query to a new page?
- How can I have sticky posts while ALSO showing posts from a specific category using one WP_Query?
- ACF: How can I publish values of ACF fields in a loop while using wp_query?
- Can I alter the main loop to ‘orderby’ a custom callback?
- Show a message if there are no active posts in category
- WooCommerce | AJAX | Product Pagination | Help me implement Ajax Pagination
- Problem with my loops
- Regarding a custom loop and output HTML tags
- Display 3 levels of categories on page
- Paging works correctly on local version, but not live?
- Custom post type loop error: Trying to get property of non-object
- Second WP_Query loop shows data from main query
- Meta Query if Values Don’t Exist
- How to add in WP_Query to every 3 posts displayed? [duplicate]
- Display three sequential posts on each page load, without repeating previous
- How to make a wordpress loop file that displays posts based on certain conditions
- Problems with WP_Query, Loop, a condition and Posts per Page
- Custom loop – Isolating post meta output depending on current query taxonomy terms
- Pagination not working with WP_QUERY
- How do I display posts with specific value in a custom field into my loop?
- Order by multiple meta keys on wordpress
- wp_query pagination links producing 404
- Display First posts without the default featured image
- Hierarchical List Pages as a table
- Pagination problem with multiple loops on the same page
- Can’t seem to get an else statement correct? [closed]
- Output ACF field dynamicaly within a taxonomy loop [closed]
- How do I split a large query with a semi-expensive function included into multiple smaller queries
- How to get rid of extra Untitled Article in html5 document outline when using new WP_Query?
- after refresh the id that shows correct in first time click, changes to 1