Have you tried using get_posts() instead?
//#get access to post settings
global $post;
//#set parameters for extra loop
$args = array(
'post_type' => 'mycustomtype',
'posts_per_page' => 12,
'orderby' => 'date',
'order' => 'DESC',
'post_status' => 'publish'
);
//#get posts
$customPosts = get_posts($args);
//#loop through them
foreach($customPosts as $post)
{
//#set all the loop functions to use data from this post
setup_postdata($post);
//#do what you want with the post
}
Related Posts:
- WP_Query by a category id and a custom post_type
- Exclude a category from WP_Query
- category__in not working on custom post type
- Adding a term name from a custom taxonomy assigned to a post link displayed by a wp_query loop based on another taxonomy
- List with categories, subcategories and posts of custom posttype
- New WP_query in template not working with CPT+category on some pages
- WP Query group/order by category name
- List all custom post type posts from a given category?
- Display Posts of a Category in Alphabetical Order (Custom Post Type)
- WP_Query with custom post_type and cat retrieving unwanted posts with the custom posts
- Query Custom Post by Category
- Loop through categories and create tab for each
- Getting all custom posts with a certain category
- Query Custom Post Types & category_name?
- Show Post Count of a Category
- CPT posts listed by category with custom rewrite URL, please help!
- Multiple post type queries (with specific arguments for each)
- Querying Term Posts in Loop
- Use get_post_types to query only custom posts types
- WP_Query | ‘post_type’ doesn’t work
- Pagination on category page with custom post types
- How to show CPTs in term archive
- showing custom post types of a certain category only
- Linking to the most recent post in a Custom Post Type
- Show custom post type filtered by category
- forming WP_Query for posts of all post types but from specific categories
- Limit amount of posts made within a custom taxonomy
- WP Query with categories only shows one post and ignores the category
- Why is my category template ignoring post type?
- WP the_posts() on single-cars.php get category link
- WP_Query Custom Post Type if Category ID Equals
- Custom post types and ‘new WP_Query’
- Custom filter for main search: how to exclude specific post_type from search results
- How to include category name/id in wp_query for retrieving “custom post type” from a particular category?
- Custom post type and standard post not displaying or working
- List categories, subcategories and posts from custom taxonomy and custom post type
- WP Query results showing posts outside of category ID
- How to get Custom Post Type with Categories wise in WordPress using wp_query
- Create query for both custom post type and category
- How to properly use Categories with Custom Post Types
- Post Type => Any conundrum
- How to output custom post type title on custom page with category next to it?
- Custom Post By Category
- Only show categories that have posts within custom post type
- Change Custom Post Type to Post + Category
- Query the title of the page to show posts with matching category in the loop
- Only show current category post
- Can’t seem to filter wp_query by current category ID
- Custom Post Type + Category archive
- category_name not working in WP_Query
- Get all custom_post_type posts + blog posts from one category in a single query
- Why does ‘exclude_from_search’ exclude a custom post type from WP_Query?
- Using tax_query to get single post per category
- Are custom posts included when getting a categories’ posts?
- Is it possible to make is_category() recursive?
- Quering array of post types & pagination. Articles are repeating sometimes on different pages
- How to put custom post types on front page
- Add custom post type items from frontend
- Custom Posts Types using Posts Category
- How to get a list of term names of the custom post type im currently on in single.php
- Get the next event using date_query
- wpdb custom post_type problem
- Filtering WP_Query
- Custom post taxonomies as tax_query terms?
- Filter CPT posts by one or more categories
- Custom post type ‘articles’ ignores posts_per_page, reserved post_type?
- Loop filtering Custom Post Types and/or Categories
- Conditional statement for if archive page has posts which contain certain taxonomies/categories/tags, show those terms
- single-{post_type}.php not working
- WordPress wp_query() basic question about args
- How to add current custom taxonomy slug to body class
- Meta data (Tags and Categories) for Custom Posts not showing.
- Custom post types with categories in template
- How to get the post terms from a child taxonomy
- WP_Query get post from a category and from another post type
- foreach loop inside the loop creating duplicates in output
- Category Name with Custom Post Type
- All blog posts are not showing up
- Order Categories by Hierarchy?
- How to divide Subcategories into pages of parent category wordpress
- meta query condition don’t work
- Filter posts by their related field’s custom field
- Custom post type category returns null
- Tell wordpress to show a single page instead of an archive page
- How do I get all authors posts of a custom post type outside loop
- minimize wp_query call to database
- sorting in wp query based on custom field value
- Custom post type post_type_link gives “page not found” on any other custom post type
- WordPress loop add heading before first of type
- Custom Post Type shows pagination (w/404) or posts_per_page query, but not both
- Pulling in Related Posts based on Post Type array
- Page to show custom posts and one category
- Storing/querying custom date data
- Query Posts From Multiple Post Types
- Bulk remove category from custom post type?
- How do I hide single category post on my post page
- Can WordPress show posts based on a button that the user clicked 2 pages back?
- querying to custom field over ACF REST API
- How can I show posts with the same tag?
- Custom Post Types Permalink