Use wp_parse_id_list
to split a comma separated string of IDs into an array:
'post__in' => wp_parse_id_list( $post_id ),
Related Posts:
- Loop within a loop?
- WP_Comment_Query pagination, delving into the unknown
- Sort posts by category name and title
- Getting all user metadata from user
- ajax category filter
- Display posts the match taxonomy term linked from wp_list_categoies?
- How to get posts in different language from WPML Plugin [closed]
- Limit WP_Query to only X results (total, not per page)
- How to disable main query?
- Use post__in and post__not_in together?
- WP_Query on different site in a multisite setup
- how to retrieve specific product attribute value in an sql query?
- How to user WP_Query to lower the number of queries
- Compile two queries to one set of results?
- how do i combine keyword search and taxonomy in a WP_query $args array Worpresss [closed]
- Only display authors who have posts
- Sanitizing search data for use with WP_Query
- How to search by a post and a category name on wordpress at the same time?
- How to retrieve current page WP_Query arguments?
- How can I get an array of all IDs from the current queried object?
- Query Custom Post Type Order By Taxonomy Field
- Query post from all category with same tag on 1 pages
- How to correctly pass values to wpdb->prepare()?
- How to use filter hook “the_posts” with a function that refers to $this?
- Multiple loops without repeating content
- WP_Query, pre_get_posts and offset
- Sort query by author: 1 author, then others
- add_actions called from functions.php not returning good values
- Multiple Search Terms WP_Query
- Filtering posts from different categories into different section by doing WP_Query only once
- Show posts from a custom taxonomy on a page
- Suggestions on making this query/code more performant
- Where to put meta Keys
- How to return a 404 when custom query matches nothing?
- Should wp_query automatic meta and term cache priming be used in an enviroment with an object caching
- wp_query with custom post type only returning last posted
- Display custom tags on pages that have a specific page parent
- Slow WP_Query with ‘OR’ on meta_query
- How to filter a query by multiple meta keys and order by other meta keys
- Multiple Orderby’s using random order WP_Query
- Custom query: Get all posts that are from a certain category?
- using pre_get_posts for search results not found
- Transient api Caches confused
- How can I override one post and make it display content for another post?
- Exclude parent with child pages from WP_Query
- Co-authors list of all posts
- Query Posts by Tag and exclude
- get_posts always returning the same number of posts = 5
- How to import a WP backup website into another WordPress hosting?
- How to apply a function to a metadata value before launch a WP Query?
- Pagination for custom loop on custom page template is not displaying anything
- Display posts by tag
- Overriding $wp_query on a template
- How to use ‘WP_Query’ or ‘query_posts’ to display content in a descending order
- How to display specific ids of posts using wp_query?
- Writing less unnecessary code with WordPress
- query single random post works localhost, not on live site
- Display count number of posts with the same specific meta_key meta_value
- Tax_Query using WP_Query not working
- How to stack name list in non-alphabetical order?
- Magazine style frontpage with multiple categories/loops and no duplicate posts
- orderby ignored by wp_query
- $wp_query->found_posts not returning correct value
- Replace wp_query with wp_user_query
- How can I use arrays and a foreach to generate many lists with WP_Query?
- Apply a custom WP_Query to the whole multisite network
- display ACF repater field in archive page
- Custom Taxonomy Archive Page to display either ALL listings or only from URL
- WordPress Query for CPT that only shows posts within radius of current user’s geolocation
- Meta query ignores multiple values of the key
- Any way to use FETCH_KEY_PAIR with $wpdb?
- Filter admin ajax data by url query
- How to get user avatar via WPDB
- One of two similar WP Query is very slow
- Using a variable within the blog posts array query – posts_per_page as variable
- Woocomerce – Order products by float attribute in archive pages
- Complex Meta Query
- Order search results by multiple post_types
- Single query for multiple categories
- Best way to query posts and order by relevancy to query
- WordPress conflict with multiple load more posts functions on click
- why default wordpress loop not working outside index.php
- Woocommerce WP_Query post__not_in problem
- Create custom order sortby based on array of id
- How to combine nested tax_query logic with other nested query logic?
- complex query question
- WP_Query for liked posts is showing all posts if none are liked
- custom query – offset to pagination
- Order Custom Field by Price
- When should you use WP_Query vs query_posts() vs get_posts()?
- Stop link being removed in menu/list when viewing that post
- Manipulating a query
- Can’t get pagination to work with this WP_Query loop
- Passing additional variables to a query
- Pagination in custom loop [duplicate]
- wp query problem
- query_vars category_name only display one catgory out of multiple categories
- Incorrect posts displayed on category page
- WordPress extremely slow when using get_posts with multiple meta_query relations
- Search results stuck on page 1