Could anyone help me figure out why hook_menu_link_alter() only affects some of my menu items. When I try to hide or change the menu title of existing menu items only some of them actually change. I changed the weight of my module every which way but it doesn't seem to have an effect.

I've rebuilt menus, reset the cache but it only affects some menu items. The following example is supposed to hide the Create Content link.

function menufun_menu_link_alter(&$item, $menu) {
    if ($item['link_path'] == 'node/add') {
        $item['hidden'] = 1;
    }
}

Thanks

Comments

frdesign’s picture

someone can shed some light here.

frdesign’s picture

In case anyone else runs into this in the future if the customized column in the menu_links table is set to 1, hook_menu_link_alter() won't have an effect on that particular menu link. Only those set to 0 can be modified this way.

Now the question is what purpose does the customized field serve? Can anyone shed some light on this?

jeremy’s picture

There's another discussion of this here which explains better:
http://drupal.org/node/347227

Essentially, your customized menus will only call hook_link_alter when you manually edit them, they don't get rebuilt when you flush the cache.