This outputs the title of a menu using wp_get_nav_menu_object
(and prepends to the Content).
function pg_show_nav_menu_title ( $content ) {
// ID of the menu you want
$nav_menu_id = 14;
//Get menu into an object
$nav_menu_object = wp_get_nav_menu_object( $nav_menu_id );
//Get the name (title)
$nav_menu_title = $nav_menu_object->name;
//String to return as Content
$content="Nav menu title: " . $nav_menu_title . '<br>' . $content;
return $content;
}
add_filter( 'the_content' , 'pg_show_nav_menu_title' );
Note: You can get the id of any menu in Dashboard > Appearance > Menus. Right-click on the Select menu and show source. The numbers in the options are the IDs. In the example above, I grabbed ’14’ from:
<select name="menu" id="menu">
<option value="14">Primary</option>
<option value="237">Top (Secondary Navigation Menu)</option>
</select>