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'm using the Menubar plugin to place a menu at the top of my website. However, I need to find a way to check if the menu contains items or not. My menu is called 'menubar'. Currently, I'm loading the menu like so:

do_action('wp_menubar', "menubar");

It loads fine, but I need to check if there are items in it or not so I can adjust and display other things instead. Any ideas? Or is this question too vague?

share|improve this question
up vote 0 down vote accepted

Try this:

 $meniu = count(wp_nav_menu( array('menu' => 'menubar' )));
                       if($meniu > 0 ){
                           //here goes your stuff if we have items in menu
share|improve this answer
You may want to prevent the display by adding 'echo' => FALSE, to the first wp_nav_menu argument. – Nabil Kadimi Feb 10 '14 at 12:18

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.