public function list_( $args, $assoc_args ) {

		$menus = wp_get_nav_menus();

		$menu_locations = get_nav_menu_locations();
		foreach ( $menus as &$menu ) {

			$menu->locations = [];
			foreach ( $menu_locations as $location => $term_id ) {

				if ( $term_id === $menu->term_id ) {
					$menu->locations[] = $location;
				}
			}

			// Normalize the data for some output formats.
			if ( ! isset( $assoc_args['format'] ) || in_array( $assoc_args['format'], [ 'csv', 'table' ], true ) ) {
				$menu->locations = implode( ',', $menu->locations );
			}
		}

		$formatter = $this->get_formatter( $assoc_args );

		if ( 'ids' === $formatter->format ) {
			$ids = array_map(
				function( $o ) {
					return $o->term_id;
				},
				$menus
			);
			$formatter->display_items( $ids );
		} else {
			$formatter->display_items( $menus );
		}
	}
public function list_( $args, $assoc_args ) {

		$menus = wp_get_nav_menus();

		$menu_locations = get_nav_menu_locations();
		foreach ( $menus as &$menu ) {

			$menu->locations = [];
			foreach ( $menu_locations as $location => $term_id ) {

				if ( $term_id === $menu->term_id ) {
					$menu->locations[] = $location;
				}
			}

			// Normalize the data for some output formats.
			if ( ! isset( $assoc_args['format'] ) || in_array( $assoc_args['format'], [ 'csv', 'table' ], true ) ) {
				$menu->locations = implode( ',', $menu->locations );
			}
		}

		$formatter = $this->get_formatter( $assoc_args );

		if ( 'ids' === $formatter->format ) {
			$ids = array_map(
				function( $o ) {
					return $o->term_id;
				},
				$menus
			);
			$formatter->display_items( $ids );
		} else {
			$formatter->display_items( $menus );
		}
	}
public function list_ ( $ args , $ assoc_args ) { $ menus = wp_get_nav_menus ( ) ; $ menu_locations = get_nav_menu_locations ( ) ; foreach ( $ menus as & $ menu ) { $ menu -> locations = [ ] ; foreach ( $ menu_locations as $ location => $ term_id ) { if ( $ term_id === $ menu -> term_id ) { $ menu -> locations [ ] = $ location ; } } // Normalize the data for some output formats. if ( ! isset ( $ assoc_args [ 'format' ] ) || in_array ( $ assoc_args [ 'format' ] , [ 'csv' , 'table' ] , true ) ) { $ menu -> locations = implode ( ',' , $ menu -> locations ) ; } } $ formatter = $ this -> get_formatter ( $ assoc_args ) ; if ( 'ids' === $ formatter -> format ) { $ ids = array_map ( function ( $ o ) { return $ o -> term_id ; } , $ menus ) ; $ formatter -> display_items ( $ ids ) ; } else { $ formatter -> display_items ( $ menus ) ; } }
Gets a list of menus.

## OPTIONS

[--fields=<fields>]
: Limit the output to specific object fields.

[--format=<format>]
: Render output in a particular format.
---
default: table
options:
- table
- csv
- json
- count
- ids
- yaml
---

## AVAILABLE FIELDS

These fields will be displayed by default for each menu:

* term_id
* name
* slug
* count

These fields are optionally available:

* term_group
* term_taxonomy_id
* taxonomy
* description
* parent
* locations

## EXAMPLES

$ wp menu list
+---------+----------+----------+-----------+-------+
| term_id | name     | slug     | locations | count |
+---------+----------+----------+-----------+-------+
| 200     | My Menu  | my-menu  |           | 0     |
| 177     | Top Menu | top-menu | primary   | 7     |
+---------+----------+----------+-----------+-------+

@subcommand list
Gets a list of menus .