I'm trying to block access to Drupal's taxonomy pages for anonymous users.

I'm using the solution set out in this answer, but for Drupal 7 rather than 6.

I'm using hook_menu_alter and hook_permission to create a new access argument for taxonomy pages. The permission is successfully created, but no matter what roles I tick the pages remain blocked. Any ideas what I'm doing wrong?

Example Code

function custom_module_menu_alter(&$items) {
  $items['taxonomy/term/%']['access arguments'] = array('access taxonomy permission');

function custom_module_permission() {
  return array(
    'access taxonomy permission' => array(
        'title' => t('Access taxonomy pages'),

1 Answer 1


Is there any special reason that you're using 'taxonomy/term/%' instead of 'taxonomy/term/%taxonomy_term' in your implementation of hook_menu_alter()? If not, I would change that and clear the cache, see if it helps.

Edit...Here's a code example from the Term Per Role module:

function term_per_role_menu_alter(&$items) { 
  $path = 'taxonomy/term/%taxonomy_term'; 
  if (isset($items[$path])) { 
    $items[$path]['page arguments'] = array_merge($items[$path]['page arguments'], array($items[$path]['page callback'])); 
    $items[$path]['page callback'] = 'term_per_role_taxonomy_term_page'; 

(A module which I would have recommended but the last commit on the project was over 3 years ago.)

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.