Esiste un modo molto semplice per ottenere il numero di post presenti in una categoria di WordPress.
La soluzione รจ la seguente:
$cat_ID = get_query_var( 'cat' );
$cat = get_the_category( $cat_ID );
$category_posts_count = $cat->category_count;