slugs_to_suppress = $slugs ?? []; } /** * Register hooks. Runs on admin_menu / network_admin_menu priority 5 * (before standard priority 10). */ public function init(): void { AdminContext::bind_menu([$this, 'suppress_legacy_menus'], 5); } /** * Remove any legacy top-level menus from the slug list. */ public function suppress_legacy_menus(): void { foreach ($this->slugs_to_suppress as $slug) { remove_menu_page($slug); } } /** * Return the list of slugs this suppressor will remove. * * @return string[] */ public function get_slugs(): array { return $this->slugs_to_suppress; } }