Parameters
- $locations
-
(array) (Optional) Associative array of menu location identifiers (like a slug) and descriptive text.
Default value: array()
See register_nav_menu() for creating a single menu, and Navigation Menus for adding theme support.
This function automatically registers custom menu support for the theme, therefore you do not need to call add_theme_support( 'menus' );
Use wp_nav_menu() to display your custom menu.
On the Menus admin page, there is a Show advanced menu properties to allow “Link Target” “CSS Classes” “Link Relationship (XFN) Description”
Use get_registered_nav_menus to get back a list of the menus that have been registered in a theme.
Source
File: wp-includes/nav-menu.php
function register_nav_menus( $locations = array() ) {
global $_wp_registered_nav_menus;
add_theme_support( 'menus' );
foreach ( $locations as $key => $value ) {
if ( is_int( $key ) ) {
_doing_it_wrong( __FUNCTION__, __( 'Nav menu locations must be strings.' ), '5.3.0' );
break;
}
}
$_wp_registered_nav_menus = array_merge( (array) $_wp_registered_nav_menus, $locations );
}
Changelog
Version | Description |
3.0.0 | Introduced. |