Skip to main content

Theme_menu_links: How to target a specific menu in Drupal

Today we needed to override the menu links of one menu on our Drupal 7 site. We started with theme_menu_links(), but quickly decided that we didn't want to figure out what menu every menu link belonged to. After some searching we discovered this comment (https://api.drupal.org/comment/26939#comment-26939) which suggested using this naming structure:

THEMENAME_menu_link__MENU_NAME()

Sure enough, once this function was placed in our theme, the exact menu was targeted and we didn't have to wade through every menu item.


Comments