WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to display the name of a custom menu in the frontend? I can't use the widget title because of the usage of many languages.

share|improve this question

migrated from stackoverflow.com Nov 4 '11 at 15:13

This question came from our site for professional and enthusiast programmers.

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:


$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);
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.