7 system.api.php hook_menu_alter(&$items)
6 core.php hook_menu_alter(&$items)

Alter the data being saved to the {menu_router} table after hook_menu is invoked.

This hook is invoked by menu_router_build(). The menu definitions are passed in by reference. Each element of the $items array is one item returned by a module from hook_menu. Additional items may be added, or existing items altered.


$items: Associative array of menu router definitions returned from hook_menu().

Related topics

1 function implements hook_menu_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

comment_menu_alter in modules/comment/comment.module
Implements hook_menu_alter().
1 invocation of hook_menu_alter()
menu_router_build in includes/menu.inc
Collects and alters the menu definitions.


modules/system/system.api.php, line 1314
Hooks provided by Drupal core and the System module.


function hook_menu_alter(&$items) {
  // Example - disable the page at node/add
  $items['node/add']['access callback'] = FALSE;


The following implements hook_menu_alter to remove access to the "forum" tab for the anonymous user:

* Implements hook_menu_alter.
* Check access for forum menu item.
function MYMODULE_menu_alter(&$items) {
  $items['forum']['access callback'] = '_accesscheck';

* Callback to disallow access for the anonymous user.
function _accesscheck(){
  global $user;
  return $user->uid;

If you do not grant the anomymous user access to forum content, the anomymous user still has access to the forum landing page. This is rather pointless, so the example above is useful if you want to avoid this.

A lot of projects we do require hiding the standard "/node" page (you can change the front page, but /node stays active)

* Restrict access to /node
function MODULE_menu_alter(&$items) {
    $items['node']['access callback'] = FALSE;


really useful and practical point!


This one makes you a redirect loop.

This hook is located in includes/menu.inc line 2761. Documentation should be updated.

I should ammend that to say that the hook is invoked at that location. The API documentation is in system.api.inc..