Custom Module to remove User Menu Tabs I'm hoping someone can take pity on me because I just can't seem to figure out how to make a simple module to remove, or hide some tabs in my user pages.
I read the docs on making custom modules, questions about removing tabs, and thought I figured it out. I made a custom module called 'TabEdit' with this structure, just to test it out:
/tabedit
    tabedit.info.yml
    tabedit.module

tabedit.info.yml
name: TabEdit
description: Edit tabs shown in user pages.
type: module
package: custom
core: 8.x
core_version_requirement: ^8 || ^9

tabedit.module
&lt;?php
/**
 * Implements hook_menu_local_tasks_alter()
 */
function tabedit_menu_local_tasks_alter(&amp;$data, $route_name) {
  unset($data['tabs'][0]['simplenews.newsletter_subscriptions_user']);
}


It didn't work, so I obviously still don't get the fundamentals on how to make a module. What I want to do is remove the Shortcuts, Simplenews Subscriptions, Activity, and Submissions from the user menu tabs.
Hooks need to be written in . module file not in controller. Move your code to .module file and also it should be tabedit_menu_local_tasks_alter
tabedit.module
&lt;?php

/**
 * Implements hook_menu_local_tasks_alter()
 */
function tabedit_menu_local_tasks_alter(&amp;$data, $route_name) {
  unset($data['tabs'][0]['simplenews.newsletter_subscriptions_user']);
}


Clear flush all caches so hook gets pickedup.