mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
Check link_count not category_count when doing link hierarchy. Props mdawaffe. fixes #3453
git-svn-id: http://svn.automattic.com/wordpress/trunk@4627 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
0aa19529f9
commit
60fdec501d
@ -111,15 +111,15 @@ function &get_categories($args = '') {
|
||||
// Update category counts to include children.
|
||||
if ( $hierarchical ) {
|
||||
foreach ( $categories as $k => $category ) {
|
||||
$progeny = $category->category_count;
|
||||
$progeny = 'link' == $type ? $category->link_count : $category->category_count;
|
||||
if ( $children = _get_cat_children($category->cat_ID, $categories) ) {
|
||||
foreach ( $children as $child )
|
||||
$progeny += $child->category_count;
|
||||
$progeny += 'link' == $type ? $child->link_count : $child->category_count;
|
||||
}
|
||||
if ( !$progeny && $hide_empty )
|
||||
unset($categories[$k]);
|
||||
else
|
||||
$categories[$k]->category_count = $progeny;
|
||||
$categories[$k]->{'link' == $type ? 'link_count' : 'category_count'} = $progeny;
|
||||
}
|
||||
}
|
||||
reset ( $categories );
|
||||
|
Loading…
Reference in New Issue
Block a user