How do we count the number of child categories of a parent category? I am using a custom taxonomy, called: “authors”.
I found this code, which does count the number of child categories, but only globally, not of one specific parent.
$num_cats = wp_count_terms('authors');
$num_parent_cats=count(get_categories('parent=0&hide_empty=0'));
$num_child_cats = $num_cats-$num_parent_cats;
echo '<p>number of child categories: ' . $num_child_cats . '</p>';
Source: https://wordpress.org/support/topic/child-category-count