Skip to content
wp-skills
Register
tools/menu-generator

WordPress Nav Menu Generator

The WordPress menu generator is a tool that allows WordPress users to easily create and edit navigation menus on their sites.

Not register_nav_menus: that is the core function this calls, and a callback of the same name is a fatal redeclaration.

Your theme or plugin's own domain. It is what pairs the menu names below with your .po files.

Menus1
  • #1

    The theme_location you pass to wp_nav_menu() in a template.

    What Appearance → Menus shows. This one is translated; the slug is not.

snippet.php
function wpskills_register_nav_menus() {
	$locations = array(
		'primary-menu' => __( 'Primary menu', 'text-domain' ),
	);

	register_nav_menus( $locations );
}
// after_setup_theme, not init: this is the hook the theme handbook documents
// for menu registration, and it runs early enough that the locations exist
// before anything tries to render one.
add_action( 'after_setup_theme', 'wpskills_register_nav_menus' );