1$menu_location = 'header';
2
3$menu_locations = get_nav_menu_locations();
4
5$menu_object = (isset($menu_locations[$menu_location]) ? wp_get_nav_menu_object($menu_locations[$menu_location]) : null);
6
7$menu_name = (isset($menu_object->name) ? $menu_object->name : '');
8
9echo esc_html($menu_name);
10
1<?php $menu_name = 'sidebar-menu'; //menu slug or menu location
2$locations = get_nav_menu_locations();
3$menu = wp_get_nav_menu_object( $locations[ $menu_name ] );
4$menuitems = wp_get_nav_menu_items( $menu->term_id, array( 'order' => 'DESC' ) );
5
6echo "<pre>";
7print_r($menuitems);
8echo "</pre>";
9?>
10
1 Object (
2 term_id => 4
3 name => My Menu Name
4 slug => my-menu-name
5 term_group => 0
6 term_taxonomy_id => 4
7 taxonomy => nav_menu
8 description =>
9 parent => 0
10 count => 6
11 )
12