php - Function to count and display the number of all subcategories in Wordpress -
i tried find function wordpress allows me count number of subcategories exist show it, far without success.
some help? in advance
if need number try this
$args = ['fields' => 'id=>parent', 'get' => 'all']; $categories = get_categories($args); $subcategories = array_filter($categories); echo "total subcategories: " . count($subcategories);
Comments
Post a Comment