I am new to wordpress and I am creating a theme for a local company as my final project towards my college degree. They wish to use this theme as a main theme for all their wp sites and that any change in design shall be taken care of by child themes.

they requested that some subpages should have a sidebar menu and some others to have another sidebar menu.

I have made a metabox with a dropdownlist in the page editor so that I can select a menu for each page. The dropdownlist displays all registered menus that are hardcoded inside the theme but not the ones created inside the admin menu editor.

$menus = get_registered_nav_menus();
echo '<select>';
foreach($menus as $menu => $value){
   echo '<option value="'.$menu.'">' . $value .'</option>';
echo '</select>';

How can I also get the menus that are created with the admin menu editor?

2 Answers 2


Maybe this helps :

function get_all_wordpress_menus(){
    return get_terms( 'nav_menu', array( 'hide_empty' => true ) ); 

get_registered_nav_menus only gets the theme's menu's and not the clients menu's.

Source : Paulund This returns all ID's. To get the name you can use :

<?php $nav_menu = wp_get_nav_menu_object(ID comes here); echo $nav_menu->name; ?>

All menu objects have the next settings :

Object (
term_id => 7
name => Test menu
slug => Test menu
term_group => 0
term_taxonomy_id => 3
taxonomy => nav_menu
description =>
parent => 0
count => 6

Source : Stanhub Display wordpress menu title

  • If this is the answer you are looking for please flag it as an answer and let me know it worked ^^ Commented Apr 20, 2017 at 12:01
  • seems this might help! now i get 4 integers that i suppose are the id of the nav menus i have created. now i just need to get the name from the id so i can display the name of the menu.
    – arrowfan
    Commented Apr 20, 2017 at 12:21
  • <?php $nav_menu = wp_get_nav_menu_object(IDhere); echo $nav_menu->name; ?> Commented Apr 20, 2017 at 12:29
  • cheers mate! wp_get_nav_menu_object woorks like a charm! you are my hero ;)
    – arrowfan
    Commented Apr 20, 2017 at 12:39
  • No problems mate. Its what the stackexchange is for Commented Apr 20, 2017 at 12:49

To get a list of all menus created through the WordPress menu editor, use the wp_get_nav_menus function.

var_dump( wp_get_nav_menus() );

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.