This code

echo wp_nav_menu( array( 'theme_location' => 'primary-menu', 'depth' => '2', 'echo' => false ) );


- Parent
- Parent
- Parent

instead of:

- Child 1
- Child 2
- Child 3

How can I print the menu with correct children names?

1 Answer 1


wp_nav_menu displays the menu created in the Appearences > Menu section of wordpress admin area. That is where you can "print the menu with correct children names".

Unless there is some other code in your functions that is messing with the wp_nav_menu function.

  • yes I know that. If I call wp_nav_menu outside the element <nav id="main_menu"> it works, but the problem is when I call it inside that element. I can't get what's the issue
    – Fred K
    Jul 7, 2015 at 12:25
  • 1
    If its only happening when in a certain container, then that makes me think it could be css or js effecting it. Could you perhaps link to the site? Or provide any other information.
    – ngearing
    Jul 8, 2015 at 5:49
  • Yeah Nath, that was it! It was a JS that change some html... thanks.
    – Fred K
    Jul 13, 2015 at 13:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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