Reputation: 39
I'm working on a custom store locator based on a WordPress custom post type (winkels). Every store can be assigned to a taxonomy term within the taxonomy "winkelketen" (store chain). There are 3847 stores in total and querying them all with WP_Query works fine. When I create a WP_Query by a specific taxonomy term, not all posts within that taxonomy term are showing up.
For example: the taxonomy term "deen" counts 148 stores (posts) in WordPress. In my WP_Query I've added the taxonomy term "deen" for "winkelketen". When I count the results of the query, only 82 stores are found. This is my code:
$deen_stores_args = array(
'post_type' => 'winkels',
'post_status' => 'publish',
'posts_per_page' => -1,
'winkelketen' => 'deen'
);
$deen_stores_query = new WP_Query( $deen_stores_args );
Facts:
What am I doing wrong or is there any limit within the WordPress core that needs to be increased?
Upvotes: 0
Views: 235
Reputation: 437
I think the get_terms() returns total posts count regardless of post status, please try setting post_status to array('publish', 'pending', 'draft', 'auto-draft', 'future', 'private', 'inherit', 'trash'); to check whether it will show the same count of get_terms().
Upvotes: 0