Hi @Bundarr:
Testing the following basic example as a standalone file it looks like it works as expected and not as you are reporting:
<?php
include '../wp-load.php';
header('Content-type: text/plain');
$q = new WP_Query(array(
'post_type'=>array('publications', 'page')
'posts_per_page' => -1,
));
echo "SQL: {$q->request}\n";
foreach($q->posts as $post) {
echo "{$post->post_name} - {$post->post_type}\n";
}
So, I can only assume that you have some plugins or theme code that is somehow blocking?
Or maybe it is as simple as missing a 'posts_per_page' => -1
argument and thus only displaying a limited number and making it seem like it’s not working? With 'posts_per_page'
the query would look like this (-1 means ‘no limit’):
$q = new WP_Query(array(
'post_type'=>array('publications', 'page')
'posts_per_page' => -1,
));
Related Posts:
- How do I query a custom post type with a custom taxonomy?
- Get the ID of the latest post
- Using meta_query, how can i filter by a custom field and order by another one?
- Return all custom meta data for one custom post type
- Display Custom Post Type Fields
- Loading Custom Post Type Events into jQuery-based FullCalendar?
- Limit the post for differents custom post type in the same wp_query
- order by meta_value serialized array
- Posts per Page on custom Taxonomy Template
- How to get the parent’s taxonomy?
- Loading post content in FancyBox
- Multiple templates for custom post type
- ascending order custom post type
- Query not returning CPT posts
- Post Rank on Single Post page based on custom field
- How to get only one category of custom post type?
- Used with meta_query in query_posts works slowly
- Unable to display multiple post types in same query (WPML WP_Query)
- How to make an archive page displaying posts in a date range
- How to display recent posts added in several custom post types
- Display custom post types with custom date field value (before today) & order by custom date field
- How to dynamically build a multiple taxonomy query loop within a post type’s single loop?
- List custom post type by custom tax term as page title
- query_posts with a custom post type, a meta_query and sorting by post date?
- Custom query shows custom post types in trash
- Multiple post type queries (with specific arguments for each)
- Combine query_posts() and get_posts() into single query
- how can i get posts from custom post type particular taxonomy category
- What’s a better alternative to this code?
- Query/list all terms and their custom post count
- Display only one post each WEEK
- How to query_post custom posts within default taxonomy?
- How to use custom taxonomies to reference complex relationships?
- Query Custom posts of same taxonomy as the post itself
- get custom post type
- Conditional Query of Custom Post Type and custom taxonomy
- Show a Category X’s custom post type on Category X archive page?
- Polylang non-default language ignores tags in WP_Query
- How to edit this code to get the categories in achieve page?
- Category with post type pagination returns 404
- Homepage’s content is dependent on the custom field values (set automatically), how do I get homepage to update without manually updating page?
- Limit the post for differents custom post type in the same wp_query
- Different Ways to Query Custom Post Types?
- Custom post type archive page for multiple post types
- Listing all term items alphabetically / sorting loop
- How to display Related Posts based on number of taxonomy terms matched
- How to show only the most recent post on my custom post type archive?
- How to make WP_Query not to show irrelevant posts?
- What is the ID parameter for custom post types in query_posts?
- Loop for custom post types filtered by a taxonomy
- How to limit post per page of custom post type?
- Display custom posts randomly in custom taxonomy archive
- Querying multiple values from a single key
- Not able to export large no. of posts in csv
- Pagination not working on custom query on a page
- Loop through posts of only 2 statuses
- Can’t change posts per page in WordPress Post Type Query
- Best way to create a search for custom post type by custom field values
- Dynamic category name in query post
- List all posts in taxonomy term
- Query all post types but limit to parents
- HM CMB: Post Select Field for CPT ID
- 4 posts per page from single category
- Display Posts Query with IF function
- Query Multiple Custom Post Types & Exclude a Taxonomy Term
- Getting custom post type info using get_adjacent_post
- Custom Post Type Query W/Category Dropdown
- Query all posts under one taxonomy? Why is my code not working?
- Find Posts based on Child Post value
- Query for bbPress replies to current topic?
- Showing only posts from the current user who is logged in?
- returning the currect URL for nested posts
- Create a post automatically if search result has zero results
- Limit custom post type to the authors only on front-end!
- Posts per Page on custom Taxonomy Template
- Order Posts in Custom Order
- minimize wp_query call to database
- Use WP pagination functions on a custom page template
- Getting Custom Posts with Custom Taxonomy
- Query the title of the page to show posts with matching category in the loop
- How to Create movie schedule by custom post type query
- How do I get the posts from single page custom post type from a sidebar to display in a page?
- Main site single-property.php design, as homepage of a multisite
- How to set class to “current-page” on the currently viewed single post within a CPT
- WordPress custom post type
- How to get main div html to print a list of posts inside?
- WordPress custom post type queries
- Query Distinct Taxonomies of Custom Post Type
- Custom Query With Multiple Meta Key Value
- Ordering custom post type by custom field without a title
- How can I list custom post by custom category?
- Query Posts From Multiple Post Types
- Advanced Custom Fields: query posts filtered by multiple field values
- How to apply order on custom taxonomy and custom meta key on custom post type
- Inserting two categories
- How do I correctly query posts from a post ID?
- How to exclude certain portfolios from a loop
- show custom post’s post in two different divs [duplicate]
- How to get Custom post type by related category ID
- Display ACF object field data using Elementor Custom Query