WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to hide a large number of categories from both the primary and secondary menus which have already been create however don't as yet contain posts.

Any PHP code i can use for this as there's a large number of categories.

share|improve this question
What does the code that generates the menus look like? – Pat J May 14 '13 at 1:04
Its a child theme built on Genesis – Brad Dalton May 14 '13 at 4:02

It depends which function you are using for querying those categories, but all of them has hide_empty argument

for example for:

     get_terms( $taxonomies, $args );
     $taxonomies = array( 
     $args = array(
         'hide_empty'    => true, 


by default, hide_empty argument is empty so check if it's false in you code.

share|improve this answer
I just don't understand how to put this is a custom function – Brad Dalton May 14 '13 at 4:03
what is this plugin or whatever you are using for displaying those menus? – CBeTJlu4ok May 14 '13 at 4:06
no plugin. Its the default Genesis menu which uses the WordPress menu. – Brad Dalton May 14 '13 at 16:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.