0
votes

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:

  • Posts per page is set to unlimited (-1)
  • All stores are published (post_status)
  • The issue is visible on both my local WordPress and our testing server

What am I doing wrong or is there any limit within the WordPress core that needs to be increased?

Here is a screenshot to make the issue more visible:

enter image description here

1

1 Answers

0
votes

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().