I am trying to get the post count for a term and it's child terms. I tried it with pad_count=> true
but this seems to have no effect.
My term stucture is like the following:
- term 1: 10 posts
- term 2: 1 post
-- subterm 1: 4 posts
-- subterm 2: 12 posts
- term 3: 4 posts
This is my code:
$args = array(
'pad_counts' => true
);
$terms = get_terms('category', $args);
foreach($terms as $term) {
var_dump( $term->count );
}
For all the terms without children this works just fine, but for the "term 2", I want to get the counts of itself and it's children combined. In my example this would be 17. The code only gives me 1, though.
Any Tips?