October 6, 2017

Stats

get_results(“SELECT name, slug FROM “. $wpdb->prefix . “terms
WHERE term_id IN (SELECT term_id FROM “. $wpdb->prefix . “term_taxonomy WHERE taxonomy = ‘category’ AND count = 0 ) “);
$usedCategory = $totalCategory – count($unusedCategory);

// get parent and child category
$totalParentCategory = count(get_categories(‘parent=0&hide_empty=0’));
$totalChildCategory = $totalCategory – $totalParentCategory;

// find most and less used category
$mostArgs=array(‘orderby’ => ‘count’,’order’ => ‘DESC’,’hide_empty’ => 0,’number’ => 5);
$mostUsedcategories=get_categories($mostArgs);
$lessArgs=array(‘orderby’ => ‘count’,’order’ => ‘ASC’,’hide_empty’ => 0,’number’ => 5);
$lessUsedcategories=get_categories($lessArgs);

?>

WP Show Stats – Category Statistics