WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

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

need help regarding wordpress navigation

i am using

 if ( has_nav_menu( 'main_nav' ) ) {
   wp_nav_menu( array('menu' => 'guest menu' )); 

from back end if i keep the menu empty(do not any page/category to menu) it displays all the pages in menu on front end.

i want it it to display nothing or by default only one menu item (only one <li>) if the menu in back end is empty.

can i limit wp_nav_menu() to display only one <li>

share|improve this question
up vote 0 down vote accepted

See Function Reference/wp nav menu

if ( has_nav_menu( 'main_nav' ) ) {
    wp_nav_menu( array('menu' => 'guest menu', 'fallback_cb' => false )); 
share|improve this answer
thanks i tried this but didn't worked yesterday, now it works fine. now just one thing more. that i want only one item in front end menu even if there are many in back end – Lucky Ali Feb 21 '13 at 9:36
Write a function and use it as 'fallback_cb' in wp_nav_menu. There is no a lot of information or examples in your question to say more. – Max Yudin Feb 21 '13 at 9:39

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.