get_registered_nav_menus

Retrieves all registered navigation menu locations in a theme.

Description

(array) get_registered_nav_menus(); 

Returns (array)

Registered navigation menu locations. If none are registered, an empty array.


Usage

  1. if ( !function_exists( 'get_registered_nav_menus' ) ) { 
  2. require_once ABSPATH . WPINC . '/nav-menu.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = get_registered_nav_menus(); 
  7.  

Defined (1)

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

/wp-includes/nav-menu.php  
  1. function get_registered_nav_menus() { 
  2. global $_wp_registered_nav_menus; 
  3. if ( isset( $_wp_registered_nav_menus ) ) 
  4. return $_wp_registered_nav_menus; 
  5. return array();