Please reference the Codex entry for post/page parameters for WP_Query()
.
The 'p'
parameter takes a single post ID, as an integer.
To pass an array of posts, you need to use 'post__in'
:
$myarray = array(144, 246);
$args = array(
'post_type' => 'ai1ec_event',
'post__in' => $myarray
);
// The Query
$the_query = new WP_Query( $args );
Related Posts:
- Best Practice for PHP
- Include WP_Query in my own PHP file?
- retrieve thumbnail from post ID of best selling product in category
- How to create a WP_Query to search the Title or Tag?
- AJAX / Read More: multiple check_ajax_referer() and wp_create_nonce() not working independentely
- Display certain amount of posts on taxonomy archive page
- Result of Custom WP_Query appears on 404 Page (but result are found!)
- Show only one post for each author ( Page loads too slow )
- how to display active, upcoming and past event with featured listing with pagination
- Get list of WP Updates Across Sites
- what is diference wp_get_attachment_url / wp_get_attachment_src / get_post_thumbnail_id?
- Modern Tribe Calendar wp-query with meta query not working at all
- WP_Query meta_query results date by date
- WP_Query sort using multiple numeric meta values
- Help with adding pagination to custom wp_query
- WordPress WP_Query() Not working properly
- How to get to a specific position in wp_query?
- Get category name from custom loop and echo it once
- API response to be stored locally
- WP_Query loop, does not display special characters in title correctly
- Remove query string specific key value
- Hide post if matches current month and year
- Use WP_Query in shortcode
- How to filter posts by post format “standard” from wp-json api?
- Why is variable not working on custom sql query using wpdb?
- Random order of WP_Query results with highest meta value
- Using foreach loop breaks
- Loading the same WP_Query in two different wordpress .php templates
- How to prevent WP_Query function from returning all posts when empty?
- Dynamic content based on a URL parameter
- Get users that likes the post
- inserting a post from an extern php file but post content doesn’t show on wp site
- Security for data obtained from the database
- Create a Blog Template Page
- Exclude posts with specific metadata from search?
- Display an image if odd number of posts in grid
- How to retrieve the data from the sever and displaying it in a page?
- How to overwrite orderby with add_query_var
- get_the_ID() in the footer returns wrong value
- How to show meta value code HTML after x paragraph
- Form search query – displaying ACF “Post Object” field as results
- change the default order of posts only for specific categories
- extract serialized array to use for wp-query
- WP_Query multiple post results
- echo var into wp_query
- How to get post category list as select in front-end?
- Order a WP_Query by meta value where the value is an array
- Toolbar Hidden in a Virtual Page
- Using multiple variables to assign categories to an array
- Search.php gets metadata from first post
- the_post(); prints out style text into my HTML?
- Wp Query : Order by distance lat,lon
- Let current user know pending posts counts using wp_query
- get_terms with specific id order
- “pre_get_posts” orderby custom date field in different format?
- WordPress Search Ajax + Isotope + InfiniteScroll
- get different meta-data of a complicated query at the same time
- Using a new WP_Query inside the loop
- wp_query – Exclude the first thumbnail from lazy loading on archives
- How to call my PHP function with AJAX ? wp_query
- WordPress sorting posts by date and title using a dropdown
- How to get specific multiple pages excerpts at homepage?
- Usermeta data unserialize, extract and display in table in WordPress
- Query on a repeater date (acf)
- can I extend the WP_Query class to deal with ‘duplicate’ posts created by joining to wp_posts?
- Trying to get pagination working on WP_Query() post grid
- Check the database for a postmeta field
- Wp-query output correct, but the loop shows one less item (only sometimes)
- How to display sticky post always at the top (before regular post) in wordpress?
- WP_Query To Display Product Of Brand On Taxonomy Page
- Combine multiple queries, array_unique returns nothing
- How to display last whole post on the homepage
- wordpress query returning unexpected results
- Custom Post type Ajax search results
- Display only upcoming events / Show all events when archive year is selected
- wp_query beginner
- Transfer WordPress Login Session to an Extended Webpage on the Same Domain
- How can I display a query in a page?
- direct query to post_meta table
- Add post class in custom loop (WP_QUERY)
- WooCommerce – Print Processing orders [closed]
- List of child pages fetch next results at link click
- List sibling pages widget, exclude current page
- Why does WP_Query show only the same post even with different categories and endwhile?
- How to get category pages to look like a certain archive page?
- show/hide attachments
- Post Title Not showing up
- reorder a WP_Query, using a dropdown
- WP_Query based on another query on the page
- Does wp_query and query_posts affect website performance? [duplicate]
- WordPress post pagination on custom template not working
- Ajax Load More or View More functionality for woocommerce category layout by template overriding
- Show post like this image in my newssite [closed]
- Display biography post for today’s birthday person
- How do I run the following script from my articles page?
- Execute multiple PHP Snippets causes error?
- How to initialise WP_Query on the basis of a specific meta_value and continue iterating rest?
- Three different queries on same page
- How to sort search result by post_title, then by post_content
- How to get posts by a certain author in inner loop using outer loop variable or post title WordPress