3 Level Deep Navigation Menu Not Showing All Levels

I finally solved the issue, it was due to a default value in the Roots theme overriding the depth parameter for a hook called wp_nav_menu_args (which I didn’t even know was a hook). The code can be found in the root directory of the theme in the “inc” folder, a file called roots-cleanup.php.

The original code looks like this:

function roots_nav_menu_args($args="") {
  $args['container']  = false;
  $args['depth']      = 2;
  $args['items_wrap'] = '<ul class="nav">%3$s</ul>';
  if (!$args['walker']) {
    $args['walker'] = new Roots_Nav_Walker();
  }
  return $args;
}

As you can all see, the depth value is being set as 2, even specifying a depth parameter on the wp_nav_menu function doesn’t seem to make a different, this very function is overriding menu arguments for depth.

All I did was increase the depth to a higher value I would never ever reach of 8 like so:

function roots_nav_menu_args($args="") {
  $args['container']  = false;
  $args['depth']      = 8;
  $args['items_wrap'] = '<ul class="nav">%3$s</ul>';
  if (!$args['walker']) {
    $args['walker'] = new Roots_Nav_Walker();
  }
  return $args;
}

The lesson learned here is to ALWAYS make sure a plugin or in this case a theme framework hook isn’t changing something. I hope this helps someone else using the Roots theme and trying for multi-level menus.