public function list_( $args, $assoc_args ) {

		$items = wp_get_nav_menu_items( $args[0] );
		if ( false === $items || is_wp_error( $items ) ) {
			WP_CLI::error( 'Invalid menu.' );
		}

		// Correct position inconsistency and
		// protected `url` param in WP-CLI
		$items = array_map(
			function( $item ) {
					$item->position = $item->menu_order;
					$item->link     = $item->url;
					return $item;
			},
			$items
		);

		if ( ! empty( $assoc_args['format'] ) && 'ids' === $assoc_args['format'] ) {
			$items = array_map(
				function( $item ) {
						return $item->db_id;
				},
				$items
			);
		}

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

	}
public function list_( $args, $assoc_args ) {

		$items = wp_get_nav_menu_items( $args[0] );
		if ( false === $items || is_wp_error( $items ) ) {
			WP_CLI::error( 'Invalid menu.' );
		}

		// Correct position inconsistency and
		// protected `url` param in WP-CLI
		$items = array_map(
			function( $item ) {
					$item->position = $item->menu_order;
					$item->link     = $item->url;
					return $item;
			},
			$items
		);

		if ( ! empty( $assoc_args['format'] ) && 'ids' === $assoc_args['format'] ) {
			$items = array_map(
				function( $item ) {
						return $item->db_id;
				},
				$items
			);
		}

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

	}
public function list_ ( $ args , $ assoc_args ) { $ items = wp_get_nav_menu_items ( $ args [ 0 ] ) ; if ( false === $ items || is_wp_error ( $ items ) ) { WP_CLI :: error ( 'Invalid menu.' ) ; } // Correct position inconsistency and // protected `url` param in WP-CLI $ items = array_map ( function ( $ item ) { $ item -> position = $ item -> menu_order ; $ item -> link = $ item -> url ; return $ item ; } , $ items ) ; if ( ! empty ( $ assoc_args [ 'format' ] ) && 'ids' === $ assoc_args [ 'format' ] ) { $ items = array_map ( function ( $ item ) { return $ item -> db_id ; } , $ items ) ; } $ formatter = $ this -> get_formatter ( $ assoc_args ) ; $ formatter -> display_items ( $ items ) ; }
Gets a list of items associated with a menu.

## OPTIONS

<menu>
: The name, slug, or term ID for the menu.

[--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 item:

* db_id
* type
* title
* link
* position

These fields are optionally available:

* menu_item_parent
* object_id
* object
* type
* type_label
* target
* attr_title
* description
* classes
* xfn

## EXAMPLES

$ wp menu item list main-menu
+-------+-----------+-------------+---------------------------------+----------+
| db_id | type      | title       | link                            | position |
+-------+-----------+-------------+---------------------------------+----------+
| 5     | custom    | Home        | http://example.com              | 1        |
| 6     | post_type | Sample Page | http://example.com/sample-page/ | 2        |
+-------+-----------+-------------+---------------------------------+----------+

@subcommand list
Gets a list of items associated with a menu .