wp_get_nav_menus

Returns all navigation menu objects.

Description

(array) wp_get_nav_menus( (array) $args = array() ); 

Returns (array)

Menu objects.

Parameters (1)

0. $args — Optional. (array) => array()
Array of arguments passed on to get_terms(). Default empty array.

Usage

  1. if ( !function_exists( 'wp_get_nav_menus' ) ) { 
  2. require_once ABSPATH . WPINC . '/nav-menu.php'; 
  3.  
  4. // Optional. Array of arguments passed on to get_terms(). 
  5. // Default empty array. 
  6. $args = array(); 
  7.  
  8. // NOTICE! Understand what this does before running. 
  9. $result = wp_get_nav_menus($args); 
  10.  

Defined (1)

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

/wp-includes/nav-menu.php  
  1. function wp_get_nav_menus( $args = array() ) { 
  2. $defaults = array( 'hide_empty' => false, 'orderby' => 'name' ); 
  3. $args = wp_parse_args( $args, $defaults ); 
  4.  
  5. /** 
  6. * Filters the navigation menu objects being returned. 
  7. * @since 3.0.0 
  8. * @see get_terms() 
  9. * @param array $menus An array of menu objects. 
  10. * @param array $args An array of arguments used to retrieve menu objects. 
  11. */ 
  12. return apply_filters( 'wp_get_nav_menus', get_terms( 'nav_menu', $args), $args );