How to hide the Page tab in the wagtail admin dashboard?

34 Views Asked by At

I am in the process of integrating wagtail with an existing Django project. For the time being, there is no need to use Pages, we will continue using Django Models for now.

Is there any way to hide the Pages tab in the Admin? See screenshot below.

Wagtail Admin Dashboard

Also if I am not leveraging Pages, are any of the wagtail apps below not needed?

'wagtail.contrib.forms',
'wagtail.embeds',
'wagtail.sites',
'wagtail.users',
'wagtail.snippets',
'wagtail.documents',
'wagtail.images',
'wagtail.search',
'wagtail.admin',
'wagtail',
1

There are 1 best solutions below

0
redtomato On

Figured out how to hide the page tab by tapping into the construct_main_menu hook and omitting the ExplorerMenuItem

from wagtail import hooks
from wagtail.admin.wagtail_hooks import ExplorerMenuItem

@hooks.register('construct_main_menu')
def hide_snippets_menu_item(request, menu_items):
    menu_items[:] = [item for item in menu_items if not isinstance(item, ExplorerMenuItem)]