Resurrect hide_empty
git-svn-id: http://svn.automattic.com/wordpress/trunk@6048 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
94973a275b
commit
a428494291
|
@ -514,23 +514,23 @@ function &get_terms($taxonomies, $args = '') {
|
|||
// Update category counts to include children.
|
||||
if ( $pad_counts )
|
||||
_pad_category_counts($type, $categories);
|
||||
*/
|
||||
|
||||
// Make sure we show empty categories that have children.
|
||||
if ( $hierarchical && $hide_empty ) {
|
||||
foreach ( $categories as $k => $category ) {
|
||||
if ( ! $category->{'link' == $type ? 'link_count' : 'category_count'} ) {
|
||||
$children = _get_cat_children($category->cat_ID, $categories);
|
||||
foreach ( $terms as $k => $term ) {
|
||||
if ( ! $term->count ) {
|
||||
$children = _get_term_children($term->term_id, $terms, $taxonomies[0]);
|
||||
foreach ( $children as $child )
|
||||
if ( $child->{'link' == $type ? 'link_count' : 'category_count'} )
|
||||
if ( $child->count )
|
||||
continue 2;
|
||||
|
||||
// It really is empty
|
||||
unset($categories[$k]);
|
||||
unset($terms[$k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
reset ( $categories );
|
||||
*/
|
||||
reset ( $terms );
|
||||
|
||||
$cache[ $key ] = $terms;
|
||||
wp_cache_set( 'get_terms', $cache, 'term' );
|
||||
|
|
Loading…
Reference in New Issue