use post__in
key instead of include
to get posts from the specific post ids.
$args = array(
'post_type' => 'testimonials',
'posts_per_page' => 4,
'orderby' => 'ID',
'post__in' => array(883, 563, 568, 106),
);
And to order posts
by the given posts ids
, you can use the following array.
$args = array(
'post_type' => 'testimonials',
'posts_per_page' => 4,
'orderby' => 'post__in',
'post__in' => array(883, 563, 568, 106),
);
Related Posts:
- Limit the post for differents custom post type in the same wp_query
- ascending order custom post type
- Display custom post types with custom date field value (before today) & order by custom date field
- Limit the post for differents custom post type in the same wp_query
- Querying multiple values from a single key
- Ordering custom post type by custom field without a title
- what is the correct way to compare dates in a WP query_posts meta_query
- How to get post content by calling ajax?
- How to show all posts of the category in wordpress?
- Display a query with multiple post types and same relationship on a single page
- How to filter custom posts by tags and custom fields?
- Sort Order for a Custom Query in a Post Type Archive Not Working
- Querying custom posts and regular posts
- How to hook get_terms() to only show count of posts that have custom meta
- Using Offset in Custom Post Type Query
- Order posts by (hierarchical custom) taxonomy terms and term children
- Posts per Page on custom Taxonomy Template
- Compare 3 custom fields and sort by oldest
- Using Query Posts With Multiple Post Types And A Taxonomy
- Query posts by custom post type and custom taxonomy
- pre get posts changing the query
- How to get current post id of a custom post type in a loop using template singel-{custom type}.php?
- Quickest way to get last or oldest post date – WP Query
- ‘category__and’ for custom taxonomy?
- Post the content of a specific “Custom Post Type” post within a post using a shortcode
- Including an External File in a Post (and Using Processed Paths)
- Separate Posts and Custom Post Type in Custom Taxonomy archive template
- Custom Post Type order by modified date and custom meta field issue
- How can I pick a single post from the latest 3?
- how can i get posts from custom post type particular taxonomy category
- Setting posts per page in query_posts
- How to insert content from another Custom Post type into Post?
- Pagination is not working on single-{slug}.php but works fine on page-{slug}.php
- Sort by custom field is not working
- Sorting multiple custom post types without a meta key/value pair by sort order
- Custom post types instead of regular post’s categories in a page template
- Change or update WordPress loop based on dropdown selection
- How to query custom post types posts filtered by multiple custom taxonomies through a form selection
- Display custom post type from dynamic custom field
- Rewrite and custom post type: order by custom field not working
- List children on child post
- Previous/Next Link by Meta Value in CPT
- Get posts between custom dates
- How to order separated Custom Post Search results
- Page template with different page and post content
- Custom fields (wp_post_meta) vs Custom Table for large amount of data
- Storing a many to many post type relationship in post meta and keeping SQL ability for Joins
- Display Woocommerce Orders for specific author [closed]
- BBPress Search results in WordPress search
- pagination not working for category.php (custom post types in categories)
- Filter date from post meta when date is in string format
- Ascending Order is not Working in Custom Post Type Listining
- Get an array wich contains the post_name of every post that has the custom post_type “pelicula”
- Query Custom Post Types with checkboxes
- Custom query – get_the_terms not work
- 3 random images from custom post type, each in a div with a diffrent class
- $wpdb->get_col and ORDER BY?
- Control content before and after custom post type loop
- why is the current page title being output?
- Count custom post type based on two meta data
- attach CPT data to a taxonomy
- Check if user has comment on current post
- Having Issue on Ordering CPT by Custom Field In Custom WP Query
- Loop through posts of only 2 statuses
- Targeting custom post type via functions.php doesn’t work
- WP_Query not resetting after wp_reset_postdata
- get_terms() returns Trying to get property of non-object error for custom taxonomy
- Custom Post type showing up in loop, regular posts are not showing up
- show most viewed posts of last days by link?
- Query for bbPress replies to current topic?
- Sorting the Loop by Taxonomy Value
- Custom Query: Multiple CPTs and a taxonomy filter
- How can I loop at a Specific Taxonomy from a custom post type?
- Custom archive page for custom taxonomy and pagination issue
- Custom wp-query display post only today
- Filling custom post type posts from a rest api
- Trying to list years (for a filter) but not all years display
- Modify default Related Posts Code to Custom Post Type
- Orderby if between two meta fields
- update a posts of other custom post type
- Imported Content Doesnt Show Up On Frontend
- Optimise custom post type queries
- Trying to get custom post type attachment images to function in indexed array
- How to get Last post Id of custom post type in wordpress
- display news with pictures 3 small and one large (loop)
- Filter RSS feed for custom post type to events for next 7 days only
- Meta-Box to add multiple items one at a time and on publish save all
- Order Custom Posts by Several Fields
- Custom post type blog pagination conflict
- taxonomy terms array not working
- 404 on Pages for Custom Post Type & Query_Posts
- posting twice from an array?
- Custom meta box includes
- How to grab data (titles, thumbnails and custom fields) from multiple posts to populate a new array efficiently?
- Query custom type posts by array of IDs
- Order custom post type is beign ignored
- How to order different custom post type in category or tag template page?
- Trying to set up a range filter for related custom post types
- Query order by meta value force specific tag first
- Display ACF object field data using Elementor Custom Query