Skip to content

clarify register_nav_menus #451

@woodz-

Description

@woodz-

I feel the meaning of the array arguments of the register_nav_menus() function is not really clear (maybe for newcomers only). Furthermore how the dict key 'primary' fits to wp_nav_menu()'s 'theme_location' is not clear.

Why I am stating this is, because in my case I already have a working menu defined in wp-admin. Its name is 'Mainmenu'. And I want to apply it for the nav_walker instead of using it in a previous fusion based theme.

If I put this name into register_nav_menus() array instead of 'Primary Menu', it won't take effect. Even if I create a new menu in wp-admin with the name 'Primary Menu', it won't show up.

The only thing that worked for me was to leave the value of key 'primary' empty in wp_nav_menu function. Thus I feel I canceled out the concept of 'primary' completely as any change of the parameters of register_nav_menus() won't have any more consequence.

The statement

Displaying the Menu
To display the menu you must associate your menu with your theme location. You can do this by selecting your theme location in the Theme Locations list while editing a menu in the WordPress menu manager.

makes the situation more confusingly, since it is not clear what

associate your menu

mean. By its name? By its option under "Menu Settings" of the wp-admin? By Theme Location under "Manage Locations" of the wp-admin? ...

Also, some identifiers seem to have changed with newer wordpress versions like "Main Navigation" in wp-admin.

Would it be possible to expand the instructions by concrete samples where one can see which values are gonna be replaced? Plus mention the version of wordpress, which had been the base by the time of writing the instructions.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions