This plugin hasn’t been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.

WordPress wp nav menu Filter


If you have built custom WordPress themes, you have probably ran into needing to display navigation on subpages. Rather than try to manage several navigation menus, or try to output menus with wp_list_pages(), why not manage everything from a single menu, and just pass different parameters to show what you want? Makes sense to me…

To use it, simply add a ‘submenu’ parameter to the arguments of wp_nav_menu, like so:

  'menu' => 'header',
  'submenu' => 'Solutions' //Using parameter of Page Name

----  OR  ----

  'menu' => 'header',
  'submenu' => '46' //Using parameter of Page ID (!important - Passing ID in STRING FORMAT)

A brief Markdown Example

What can it do for me?

  • Display submenus controlled by one simple navigation menu created through the WordPress Interface

Most Common applications:

  1. Display submenu on internal pages
  2. Display submenu in footer blocks

Inside template files:

By Page Name
‘submenu’ => ‘Solutions’
)); ?>

By Current Page

<?php wp_nav_menu(array(
      'menu' => 'header',
      'submenu' => ''.$post->ID.''
    )); ?>

By Specific Page ID

<?php wp_nav_menu(array(
      'menu' => 'header',
      'submenu' => '46'
    )); ?>


  • Display just the highlighted part of an entire navigation menu based on wp_nav_menu.


What will happen if I pass an invalid page ID?

It defaults to the main menu, the same as if the plugin wasn’t activated/installed.

How do I select a menu more than one level deep?

You can go multiple levels deep by putting slashes in:

  'menu' => 'header',
  'submenu' => 'Solutions/Company Solutions'

Or you can also use an Array:

  'menu' =>
  'submenu' => array('Solutions', 'Company Solutions')
Can I use a page’s slug instead of the page title?

Currently, I see no reason to use a page slug. This functionality can be added at a later date if I see it to be necessary.

Does the title need to match exactly?

This plugin should compare the page title with what you entered and be slightly forgiving (Capital letters, etc), but you should strive to enter it exactly.

Example for inside template files:

wp_reset_query();  //Good practice to clear any of your custom loops before this code

  'menu' => 'header',
  'submenu' => ''.$post->ID.'' //This will always provide an exact match to the current loop page



  • Version 1.0 Released.


  • Version 1.1 Released.
  • Checked compatibility with latest version of WP – no changes needed.

Contributors & Developers

This is open source software. The following people have contributed to this plugin.


Browse the code