Show Custom Menu Name in WordPress 3

Yes, you can display the name of custom menu in the frontend. All you need to know is the menu location identifier. This is the same id which is used in register_nav_menu() function.

Here is the code:

<?php

$menu_location = 'primary';
$menu_locations = get_nav_menu_locations();
$menu_object = (isset($menu_locations[$menu_location]) ? wp_get_nav_menu_object($menu_locations[$menu_location]) : null);
$menu_name = (isset($menu_object->name) ? $menu_object->name : '');

echo esc_html($menu_name);