Resurrect hide_empty

git-svn-id: https://develop.svn.wordpress.org/trunk@6048 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2007-09-06 04:34:06 +00:00
parent c2c7912054
commit 459a358e04
1 changed files with 7 additions and 7 deletions

View File

@ -514,23 +514,23 @@ function &get_terms($taxonomies, $args = '') {
// Update category counts to include children. // Update category counts to include children.
if ( $pad_counts ) if ( $pad_counts )
_pad_category_counts($type, $categories); _pad_category_counts($type, $categories);
*/
// Make sure we show empty categories that have children. // Make sure we show empty categories that have children.
if ( $hierarchical && $hide_empty ) { if ( $hierarchical && $hide_empty ) {
foreach ( $categories as $k => $category ) { foreach ( $terms as $k => $term ) {
if ( ! $category->{'link' == $type ? 'link_count' : 'category_count'} ) { if ( ! $term->count ) {
$children = _get_cat_children($category->cat_ID, $categories); $children = _get_term_children($term->term_id, $terms, $taxonomies[0]);
foreach ( $children as $child ) foreach ( $children as $child )
if ( $child->{'link' == $type ? 'link_count' : 'category_count'} ) if ( $child->count )
continue 2; continue 2;
// It really is empty // It really is empty
unset($categories[$k]); unset($terms[$k]);
} }
} }
} }
reset ( $categories ); reset ( $terms );
*/
$cache[ $key ] = $terms; $cache[ $key ] = $terms;
wp_cache_set( 'get_terms', $cache, 'term' ); wp_cache_set( 'get_terms', $cache, 'term' );