Category post count is not correct
When I go to Posts Categories, some categories show that they have a post. See screenshot. But there are no posts linked to that category. When you click on that 1-number, no posts are shown.
This is an issue because my blog page shows the category title and description even if there are no actual posts linked to that category (Wedge-system - see screenshot).
This is how I loop over all the categories and show the posts from that category:
?php
$loop = new WP_Query( array(
'post_type' = 'Post',
'posts_per_page' = $post_per_page,
'tax_query' = array(
array(
'taxonomy' = 'category',
'field' = 'id',
'terms' = array( $category-term_id ),
'operator' = 'IN'
),
),
)
);
?
?php while ( $loop-have_posts() ) : $loop-the_post(); ?
/* post template here */
?php endwhile; wp_reset_query(); ?