public function list_( $args, $assoc_args ) {
		foreach ( $args as $taxonomy ) {
			if ( ! taxonomy_exists( $taxonomy ) ) {
				WP_CLI::error( "Taxonomy {$taxonomy} doesn't exist." );
			}
		}

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

		$defaults   = [
			'hide_empty' => false,
		];
		$assoc_args = array_merge( $defaults, $assoc_args );

		if ( ! empty( $assoc_args['term_id'] ) ) {
			$term  = get_term_by( 'id', $assoc_args['term_id'], $args[0] );
			$terms = [ $term ];
		} elseif ( ! empty( $assoc_args['include'] )
			&& ! empty( $assoc_args['orderby'] )
			&& 'include' === $assoc_args['orderby']
			&& Utils\wp_version_compare( '4.7', '<' ) ) {
			$terms    = [];
			$term_ids = explode( ',', $assoc_args['include'] );
			foreach ( $term_ids as $term_id ) {
				$term = get_term_by( 'id', $term_id, $args[0] );
				if ( $term && ! is_wp_error( $term ) ) {
					$terms[] = $term;
				} else {
					WP_CLI::warning( "Invalid term {$term_id}." );
				}
			}
		} else {
			$terms = get_terms( $args, $assoc_args );
		}

		$terms = array_map(
			function( $term ) {
					$term->count  = (int) $term->count;
					$term->parent = (int) $term->parent;
					$term->url    = get_term_link( $term );
					return $term;
			},
			$terms
		);

		if ( 'ids' === $formatter->format ) {
			$terms = wp_list_pluck( $terms, 'term_id' );
			echo implode( ' ', $terms );
		} else {
			$formatter->display_items( $terms );
		}
	}
public function list_( $args, $assoc_args ) {
		foreach ( $args as $taxonomy ) {
			if ( ! taxonomy_exists( $taxonomy ) ) {
				WP_CLI::error( "Taxonomy {$taxonomy} doesn't exist." );
			}
		}

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

		$defaults   = [
			'hide_empty' => false,
		];
		$assoc_args = array_merge( $defaults, $assoc_args );

		if ( ! empty( $assoc_args['term_id'] ) ) {
			$term  = get_term_by( 'id', $assoc_args['term_id'], $args[0] );
			$terms = [ $term ];
		} elseif ( ! empty( $assoc_args['include'] )
			&& ! empty( $assoc_args['orderby'] )
			&& 'include' === $assoc_args['orderby']
			&& Utils\wp_version_compare( '4.7', '<' ) ) {
			$terms    = [];
			$term_ids = explode( ',', $assoc_args['include'] );
			foreach ( $term_ids as $term_id ) {
				$term = get_term_by( 'id', $term_id, $args[0] );
				if ( $term && ! is_wp_error( $term ) ) {
					$terms[] = $term;
				} else {
					WP_CLI::warning( "Invalid term {$term_id}." );
				}
			}
		} else {
			$terms = get_terms( $args, $assoc_args );
		}

		$terms = array_map(
			function( $term ) {
					$term->count  = (int) $term->count;
					$term->parent = (int) $term->parent;
					$term->url    = get_term_link( $term );
					return $term;
			},
			$terms
		);

		if ( 'ids' === $formatter->format ) {
			$terms = wp_list_pluck( $terms, 'term_id' );
			echo implode( ' ', $terms );
		} else {
			$formatter->display_items( $terms );
		}
	}
public function list_ ( $ args , $ assoc_args ) { foreach ( $ args as $ taxonomy ) { if ( ! taxonomy_exists ( $ taxonomy ) ) { WP_CLI :: error ( "Taxonomy {$taxonomy} doesn't exist." ) ; } } $ formatter = $ this -> get_formatter ( $ assoc_args ) ; $ defaults = [ 'hide_empty' => false , ] ; $ assoc_args = array_merge ( $ defaults , $ assoc_args ) ; if ( ! empty ( $ assoc_args [ 'term_id' ] ) ) { $ term = get_term_by ( 'id' , $ assoc_args [ 'term_id' ] , $ args [ 0 ] ) ; $ terms = [ $ term ] ; } elseif ( ! empty ( $ assoc_args [ 'include' ] ) && ! empty ( $ assoc_args [ 'orderby' ] ) && 'include' === $ assoc_args [ 'orderby' ] && Utils \ wp_version_compare ( '4.7' , '<' ) ) { $ terms = [ ] ; $ term_ids = explode ( ',' , $ assoc_args [ 'include' ] ) ; foreach ( $ term_ids as $ term_id ) { $ term = get_term_by ( 'id' , $ term_id , $ args [ 0 ] ) ; if ( $ term && ! is_wp_error ( $ term ) ) { $ terms [ ] = $ term ; } else { WP_CLI :: warning ( "Invalid term {$term_id}." ) ; } } } else { $ terms = get_terms ( $ args , $ assoc_args ) ; } $ terms = array_map ( function ( $ term ) { $ term -> count = ( int ) $ term -> count ; $ term -> parent = ( int ) $ term -> parent ; $ term -> url = get_term_link ( $ term ) ; return $ term ; } , $ terms ) ; if ( 'ids' === $ formatter -> format ) { $ terms = wp_list_pluck ( $ terms , 'term_id' ) ; echo implode ( ' ' , $ terms ) ; } else { $ formatter -> display_items ( $ terms ) ; } }
Lists terms in a taxonomy.

## OPTIONS

<taxonomy>...
: List terms of one or more taxonomies

[--<field>=<value>]
: Filter by one or more fields (see get_terms() $args parameter for a list of fields).

[--field=<field>]
: Prints the value of a single field for each term.

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

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

## AVAILABLE FIELDS

These fields will be displayed by default for each term:

* term_id
* term_taxonomy_id
* name
* slug
* description
* parent
* count

These fields are optionally available:

* url

## EXAMPLES

# List post categories
$ wp term list category --format=csv
term_id,term_taxonomy_id,name,slug,description,parent,count
2,2,aciform,aciform,,0,1
3,3,antiquarianism,antiquarianism,,0,1
4,4,arrangement,arrangement,,0,1
5,5,asmodeus,asmodeus,,0,1

# List post tags
$ wp term list post_tag --fields=name,slug
+-----------+-------------+
| name      | slug        |
+-----------+-------------+
| 8BIT      | 8bit        |
| alignment | alignment-2 |
| Articles  | articles    |
| aside     | aside       |
+-----------+-------------+

@subcommand list
Lists terms in a taxonomy .