Home > Software design >  How to reorder Wagtail admin menu items
How to reorder Wagtail admin menu items

Time:06-30

There are some custom menu items in the admin's menu, it is easy to order them (the items marked in red below). Just set menu_order of the custom ModelAdmin object.

The question is how to reorder the built-in menu items, such as Pages, Images, Media, and Settings.

enter image description here

CodePudding user response:

You can use the construct_main_menu hook to modify existing menu items.

For example, to move the Pages item to the bottom, place this code in a wagtail_hooks.py file within one of your apps:

from wagtail import hooks

@hooks.register('construct_main_menu')
def reorder_menu_items(request, menu_items):
    for item in menu_items:
        if item.name == 'explorer':  # internal name for the Pages menu item
            item.order = 100000
            break
  • Related