I have a "home" link on my primary navigation menu. Once the user is logged in, the home link is irrelevant and I don't wish to show it.

I've set the access control permissions for the "home" page to only show for "anonymous user", but it's still visible in the menu once logged in. I'm guessing that authenticated users can see everything anonymous ones can, even if they don't have the box ticked. Is there some way around this?

I'm aware of "menu per role", but I read that it's better to set the permission of your content directly and let Drupal hide/show where appropriate, so I'd like to avoid using menu per role if possible.

2 Answers 2


You could hook into the menu link in the theme template and hide with some styling.

function THEME_menu_link(array $variables) {   
  $element = $variables['element'];
  $sub_menu = '';
  $name_id = strtolower(strip_tags($element['#title']));    

  if ($name_id == 'home') {
     $element['#localized_options']['attributes']['class'][] = 'hide';

Try with this code

function THEME_menu_item_link($link) {
  global $user;
  if (empty($link['localized_options'])) {
    $link['localized_options'] = array();
  if ( ($link['href'] == '<front>') && ($user->uid == 0) ){
       return '';
  } else {
      return l($link['title'], $link['href'], $link['localized_options']);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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