MrName
MrName

Reputation: 2529

Wagtail - How To Remove Sub-Menu Items From Settings Menu

Wagtail includes a "settings" menu item by default, with some default settings items, such as "sites" and "redirects".

I know that you can register a new setting with the register_setting decorator, and that various hooks are available for customizing the top level menu items, but not sub-menu items. How can I REMOVE (or hide the display of) the default settings items?

Upvotes: 1

Views: 1243

Answers (2)

ladhari
ladhari

Reputation: 535

the solution has been explained here in this website if we want to delete the user from the settings menu item

from wagtail.core import hooks

@hooks.register('construct_settings_menu')
def hide_user_menu_item(request, menu_items):
    menu_items[:] = [item for item in menu_items if item.name != 'user']

for main menu if we want to delete Images from the main menu item

from wagtail.core import hooks

@hooks.register('construct_main_menu')
def hide_images_menu_item(request, menu_items):
    menu_items[:] = [item for item in menu_items if item.name != 'images']

For higher Wagtail6.0

hooks are now imported differently

from wagtail import hooks

Upvotes: 3

Dan Swain
Dan Swain

Reputation: 3108

Create a Wagtail group (Groups under the Settings menu). When assigning object permissions for the group, make sure Site Settings is not selected. Then assign to the group the Users who you do not want to be able to see the Site Settings menu, and it will not show up for them.

Upvotes: 2

Related Questions