Adding count also to parent categories
You could add this to your code: function custom_add_count_on_archive_title( $title ) { $term = get_queried_object(); $term_id = get_queried_object()->term_id; if( $term instanceof WP_Term && ‘category’ === $term->taxonomy ) { $children_terms = get_terms(array( ‘taxonomy’ => ‘category’, ‘child_of’ => $term_id, )); $total_count = 0; if (!empty($children_terms) && !is_wp_error($children_terms)) { foreach ($children_terms as $child_term) { $total_count += $child_term->count; } … Read more