Title: Changing hide_empty in wp-includes-&gt;category-template.php without changing core?
Last modified: August 21, 2016

---

# Changing hide_empty in wp-includes->category-template.php without changing core?

 *  Resolved Anonymous User 13922460
 * (@anonymized-13922460)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/changing-hide_empty-in-wp-includes-category-templatephp-without-changing-core/)
 * Hello,
 * I am having some problems displaying empty sub categories in a menu in my theme.
   This menu is not a part of the normal menu functions. If I change “hide_empty”
   to 0 in wp-includes -> category-template.php, the sub categories will display
   properly in the menu. However, that would also include changing the core files.
   It seems I should not do that.
 * So my question then is, in my child theme, how can I change this?
 * Thank you in advance!
 * /Sunday.

Viewing 12 replies - 1 through 12 (of 12 total)

 *  [SpankMarvin](https://wordpress.org/support/users/spankmarvin/)
 * (@spankmarvin)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/changing-hide_empty-in-wp-includes-category-templatephp-without-changing-core/#post-5070190)
 * What’s the code generating the menu?
 *  Thread Starter Anonymous User 13922460
 * (@anonymized-13922460)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/changing-hide_empty-in-wp-includes-category-templatephp-without-changing-core/#post-5070191)
 * Sadly, I am not sure. How can I find out? The menu is a category page.
 * I feel like I’m learning more and more about wordpress, and whenever I learn 
   something new, there’s a dozen things I realize I don’t know. Thanks for helping
   me out 🙂
 *  Thread Starter Anonymous User 13922460
 * (@anonymized-13922460)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/changing-hide_empty-in-wp-includes-category-templatephp-without-changing-core/#post-5070192)
 * I suspect the theme only uses the general wordpress settings – yet I need to 
   find a way to change those, without changing the core files.
 *  Thread Starter Anonymous User 13922460
 * (@anonymized-13922460)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/changing-hide_empty-in-wp-includes-category-templatephp-without-changing-core/#post-5070193)
 * Ok, I think I might have found the file (sub-terms.php).
 * The code for the whole file is the following:
 *     ```
       <?php if ( is_taxonomy_hierarchical( get_queried_object()->taxonomy ) ) : // If the taxonomy is hierarchical. ?>
   
       	<?php $terms = wp_list_categories(
       		array(
       			'taxonomy'         => get_queried_object()->taxonomy,
       			'child_of'         => get_queried_object_id(),
       			'depth'            => 1,
       			'title_li'         => false,
       			'show_option_none' => false,
       			'echo'             => false
       		)
       	); ?>
   
       	<?php if ( !empty( $terms ) ) : // If a list of child categories/terms was found. ?>
   
       		<nav <?php hybrid_attr( 'menu', 'sub-terms' ); ?>>
   
       			<ul id="menu-sub-terms-items" class="menu-items">
       				<?php echo $terms; ?>
       			</ul><!-- .sub-terms -->
   
       		</nav><!-- .menu -->
   
       	<?php endif; // End check for list. ?>
   
       <?php endif; // End check for hierarchy. ?>
       ```
   
 * Really appreciate your help!
 *  [SpankMarvin](https://wordpress.org/support/users/spankmarvin/)
 * (@spankmarvin)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/changing-hide_empty-in-wp-includes-category-templatephp-without-changing-core/#post-5070194)
 * Add ‘hide_empty’ => 0 to that array?
 *  Thread Starter Anonymous User 13922460
 * (@anonymized-13922460)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/changing-hide_empty-in-wp-includes-category-templatephp-without-changing-core/#post-5070195)
 * Where would I add it?
 * Also, would it perhaps be possible to change the ” `<?php if ( !empty( $terms))://
   If a list of child categories/terms was found. ?>` “?
 *  [SpankMarvin](https://wordpress.org/support/users/spankmarvin/)
 * (@spankmarvin)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/changing-hide_empty-in-wp-includes-category-templatephp-without-changing-core/#post-5070196)
 * Anywhere in that array? So:
 *     ```
       <?php $terms = wp_list_categories(
       		array(
       			'taxonomy'         => get_queried_object()->taxonomy,
       			'child_of'         => get_queried_object_id(),
       			'depth'            => 1,
                               'hide_empty' => 0,
       			'title_li'         => false,
       			'show_option_none' => false,
       			'echo'             => false
       		)
       	); ?>
       ```
   
 * What’s the other thing you’re trying to change?
 *  Thread Starter Anonymous User 13922460
 * (@anonymized-13922460)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/changing-hide_empty-in-wp-includes-category-templatephp-without-changing-core/#post-5070198)
 * That didn’t solve it.
 * I am starting to think that the if function is what causes the problem. Right
   now it says if it’s not empty (!empty), show the menu (or?). How could I rewrite
   it so that the if function is removed completely? So that the function works 
   whether it’s empty or not.
 *  [SpankMarvin](https://wordpress.org/support/users/spankmarvin/)
 * (@spankmarvin)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/changing-hide_empty-in-wp-includes-category-templatephp-without-changing-core/#post-5070199)
 * That’s not how the function is working. It’s saying “if there is any output, 
   do the output,” not “If the category is not empty, show the category.”
 * So is your list not appearing AT ALL, or is it only showing populated terms?
 *  Thread Starter Anonymous User 13922460
 * (@anonymized-13922460)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/changing-hide_empty-in-wp-includes-category-templatephp-without-changing-core/#post-5070200)
 * It is only showing sub categories with posts.
 * It’s a sub-term menu on a category page with sub categories. If there are sub
   categories with posts, it will show those with posts. If there are both sub categories
   with posts and without, it will only show those with posts. If there are sub 
   categories without posts, it won’t show at all.
 *  Thread Starter Anonymous User 13922460
 * (@anonymized-13922460)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/changing-hide_empty-in-wp-includes-category-templatephp-without-changing-core/#post-5070201)
 * Ah, I found it! Or, more like, you did.
 * You were right all along. The problem was that my child theme wouldn’t catch 
   the php file. When I added `'hide_empty' => 0,` in the main file, that solved
   everything.
 * Thank you so much for your help. Sorry about me blandering about and making mistakes.
   I’m still learning 🙂
 *  Thread Starter Anonymous User 13922460
 * (@anonymized-13922460)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/changing-hide_empty-in-wp-includes-category-templatephp-without-changing-core/#post-5070202)
 * Closing this topic now.

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘Changing hide_empty in wp-includes->category-template.php without changing
core?’ is closed to new replies.

## Tags

 * [category-template.php](https://wordpress.org/support/topic-tag/category-template-php/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 12 replies
 * 2 participants
 * Last reply from: Anonymous User 13922460
 * Last activity: [11 years, 11 months ago](https://wordpress.org/support/topic/changing-hide_empty-in-wp-includes-category-templatephp-without-changing-core/#post-5070202)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
