Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've taken this line from header.php of TwentyTen where its loading the custom menus...

<?php /* Our navigation menu.  
If one isn't filled out, wp_nav_menu falls back to wp_page_menu.  
The menu assiged to the primary position is the one used.  
If none is assigned, the menu with the lowest ID is used.  */ ?>
<?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) ); ?>

I understand their fallback plan, but for mine, if no custom menu has been assigned to my custom menu selector, I don't want to return anything. What's the function to determine if my custom menu has an assigned menu?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

From looking at the Codex, you should be able to just pass the fallback_cb parameter as false to have wp_nav_menu return nothing. So something like:

<?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary', 'fallback_cb' => FALSE ) ); ?>
share|improve this answer
    
That's it. I found it shortly after I posted. Hopefully it helps someone. –  Scott B Mar 9 '11 at 23:04

You could also take a look at the has_nav_menu() conditional tag/function.

share|improve this answer

Your Answer

 
discard

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.