How to remove undesired local task tabs I have a node type 'faq'. For node type 'faq' I need to remove the tab 'node clone'.

For that I have done the following codes.
In node_clone.routing.yml I have the following code  

      
node_clone.prepopulate_node:  
  path: '/node/{node}/clone/prepopulate'  
  defaults:  
    _title: 'Clone content'  
    _controller: 'node_clone.form_controller:getContentResult'  
  requirements:  
    _custom_access: 'node_clone.form_controller:access'  
    #_node_add_access: 'node:{node_type}'  
    node: '\d+'  
  options:  
    _node_operation_route: TRUE  
    parameters:  
      node:  
        type: 'entity:node'  

In my controller file


public function access(AccountInterface $account, NodeInterface $node) {

      $node_type = ($node->getType());
      if($node_type=="faq")
      {
          $access = new AccessResultForbidden();

      }

    if ($account->hasPermission('clone node') || ($node->uid->value === $account->id() && $account->hasPermission('clone own nodes'))) {
      $access = new AccessResultAllowed();
    }

    else {
      $access = new AccessResultForbidden();
    }
    $access->addCacheableDependency($node);
    $access->cachePerPermissions();
    if ($access->isAllowed()) {
      $access = $access->andIf($node->access('view', $account, TRUE));
    }
    if ($access->isAllowed()) {
      $node_type = NodeType::load($node->getType());
      $access = $access->andIf($this->nodeAddAccessCheck->access($account, $node_type));
    }
    return $access;
  }


Please help me to find out what's wrong with my code? Is this enough or I should do something else?
To completely remove the tab from all pages you can use hook_local_tasks_alter().

function mymodule_local_tasks_alter(&amp;$local_tasks) {
  unset($local_tasks['local_task_to_remove']);
}


Where local_task_to_remove is the tab you want to remove.

To have it removed from some pages you could use hook_menu_local_tasks_alter() instead. Something like:

function mymodule_menu_local_tasks_alter(&amp;$data, $route_name) {
  $routes = ['entity.entity_view_display.node.default', ...]; // put other routes in place of '...'
  if (in_array($route_name, $routes)) {
    unset($data['tabs'][0]['local_task_to_remove']); 
  }
}