register_nav_menus

Registers navigation menu locations for a theme.

Description

register_nav_menus( (array) $locations = array() ); 

Parameters (1)

0. $locations — Optional. (array) => array()
Associative array of menu location identifiers (like a slug) and descriptive text.

Usage

  1. if ( !function_exists( 'register_nav_menus' ) ) { 
  2. require_once ABSPATH . WPINC . '/nav-menu.php'; 
  3.  
  4. // Associative array of menu location identifiers (like a slug) and descriptive text. 
  5. $locations = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = register_nav_menus($locations); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/nav-menu.php  
  1. function register_nav_menus( $locations = array() ) { 
  2. global $_wp_registered_nav_menus; 
  3.  
  4. add_theme_support( 'menus' ); 
  5.  
  6. $_wp_registered_nav_menus = array_merge( (array) $_wp_registered_nav_menus, $locations );