Hide node "edit" tab for certain content types and roles I am trying to hide node "edit" tab for certain content types and roles without removing or disabling access to the edit pages. An edit button is going to be created manually and displayed on node pages.

Used below snippet but it disables access to the edit pages too.

/**
* Set up a new permission for tabs.
* Grant access under admin -&gt; user management -&gt; permissions
*/
function mymodule_permission() {
  return array(
    'view hidden tabs' =&gt; array(
      'title' =&gt; t('Node tabs visibility'),
      'description' =&gt; t('Grant access to node tabs.'),
    ),
  );
}

/**
* Implementation of hook_menu_alter().
* Show/hide tabs according to permission settings.
*/
function mymodule_menu_alter(&amp;$items) {
$items['node/%node/edit']['access callback'] = 'user_access';
$items['node/%node/edit']['access arguments'] = array('view hidden tabs');
}


Also tried using this code, which kinda works but disables edit tab on all content types and for all roles.

function mymodule_menu_alter(&amp;$items) {
$items['node/%node/edit']['type'] = MENU_CALLBACK;
}


Obejective: Hide node "edit" tab for certain content types and roles in D7.
I had the same issue and could solve that using template_preprocess_page(&amp;$variables).

Open template.php under [yoursite]/themes/[your-theme]

For example if you're using bartik theme and want to hide tabs (View and Edit) for Article content type for Editor role.

Paste the following code in your template.php

/**
 * Remove tabs on article content type
 */
function bartik_preprocess_page(&amp;$variables, $hook)
{
    if (!empty($variables['node']) &amp;&amp; $variables['node']-&gt;type == 'article' &amp;&amp; in_array('editor', $variables['user']-&gt;  roles))
    {
    $to_be_removed = array('node/%/edit', 'node/%/view');
    foreach ($variables['tabs'] as $group_key =&gt;$tab_group)
        {
            if (is_array($tab_group))
            {
                foreach ($tab_group as $key =&gt;$tab)
                {
                    if (isset($tab['#link']['path']) &amp;&amp; in_array($tab['#link']['path'], $to_be_removed))
                    {
                    unset($variables['tabs'][$group_key][$key]);
                    }
                }
            }
        }
    }
}


Clear your site cache and test.

This removes the View and Edit tabs on Article node pages for editor roles users. But they can access those pages via URL.

Hope this helps.