Resurrect hide_empty
git-svn-id: https://develop.svn.wordpress.org/trunk@6048 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
c2c7912054
commit
459a358e04
|
@ -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' );
|
||||||
|
|
Loading…
Reference in New Issue