public function get( $args, $assoc_args ) {
		$taxonomy = get_taxonomy( $args[0] );

		if ( ! $taxonomy ) {
			WP_CLI::error( "Taxonomy {$args[0]} doesn't exist." );
		}

		if ( empty( $assoc_args['fields'] ) ) {
			$default_fields = array_merge(
				$this->fields,
				array(
					'labels',
					'cap',
				)
			);

			$assoc_args['fields'] = $default_fields;
		}

		$formatter = $this->get_formatter( $assoc_args );
		$fields    = $formatter->fields;
		$count     = 0;

		if ( in_array( 'count', $fields, true ) ) {
			$count = $this->get_counts( [ $taxonomy->name ] );
			$count = $count[ $taxonomy->name ];
		}

		$data = array(
			'name'          => $taxonomy->name,
			'label'         => $taxonomy->label,
			'description'   => $taxonomy->description,
			'object_type'   => $taxonomy->object_type,
			'show_tagcloud' => $taxonomy->show_tagcloud,
			'hierarchical'  => $taxonomy->hierarchical,
			'public'        => $taxonomy->public,
			'labels'        => $taxonomy->labels,
			'cap'           => $taxonomy->cap,
			'count'         => $count,
		);
		$formatter->display_item( $data );
	}
public function get( $args, $assoc_args ) {
		$taxonomy = get_taxonomy( $args[0] );

		if ( ! $taxonomy ) {
			WP_CLI::error( "Taxonomy {$args[0]} doesn't exist." );
		}

		if ( empty( $assoc_args['fields'] ) ) {
			$default_fields = array_merge(
				$this->fields,
				array(
					'labels',
					'cap',
				)
			);

			$assoc_args['fields'] = $default_fields;
		}

		$formatter = $this->get_formatter( $assoc_args );
		$fields    = $formatter->fields;
		$count     = 0;

		if ( in_array( 'count', $fields, true ) ) {
			$count = $this->get_counts( [ $taxonomy->name ] );
			$count = $count[ $taxonomy->name ];
		}

		$data = array(
			'name'          => $taxonomy->name,
			'label'         => $taxonomy->label,
			'description'   => $taxonomy->description,
			'object_type'   => $taxonomy->object_type,
			'show_tagcloud' => $taxonomy->show_tagcloud,
			'hierarchical'  => $taxonomy->hierarchical,
			'public'        => $taxonomy->public,
			'labels'        => $taxonomy->labels,
			'cap'           => $taxonomy->cap,
			'count'         => $count,
		);
		$formatter->display_item( $data );
	}
public function get ( $ args , $ assoc_args ) { $ taxonomy = get_taxonomy ( $ args [ 0 ] ) ; if ( ! $ taxonomy ) { WP_CLI :: error ( "Taxonomy {$args[0]} doesn't exist." ) ; } if ( empty ( $ assoc_args [ 'fields' ] ) ) { $ default_fields = array_merge ( $ this -> fields , array ( 'labels' , 'cap' , ) ) ; $ assoc_args [ 'fields' ] = $ default_fields ; } $ formatter = $ this -> get_formatter ( $ assoc_args ) ; $ fields = $ formatter -> fields ; $ count = 0 ; if ( in_array ( 'count' , $ fields , true ) ) { $ count = $ this -> get_counts ( [ $ taxonomy -> name ] ) ; $ count = $ count [ $ taxonomy -> name ] ; } $ data = array ( 'name' => $ taxonomy -> name , 'label' => $ taxonomy -> label , 'description' => $ taxonomy -> description , 'object_type' => $ taxonomy -> object_type , 'show_tagcloud' => $ taxonomy -> show_tagcloud , 'hierarchical' => $ taxonomy -> hierarchical , 'public' => $ taxonomy -> public , 'labels' => $ taxonomy -> labels , 'cap' => $ taxonomy -> cap , 'count' => $ count , ) ; $ formatter -> display_item ( $ data ) ; }
Gets details about a registered taxonomy.

## OPTIONS

<taxonomy>
: Taxonomy slug.

[--field=<field>]
: Instead of returning the whole taxonomy, returns the value of a single field.

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

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

## AVAILABLE FIELDS

These fields will be displayed by default for the specified taxonomy:

* name
* label
* description
* object_type
* show_tagcloud
* hierarchical
* public
* labels
* cap

These fields are optionally available:

* count

## EXAMPLES

# Get details of `category` taxonomy.
$ wp taxonomy get category --fields=name,label,object_type
+-------------+------------+
| Field       | Value      |
+-------------+------------+
| name        | category   |
| label       | Categories |
| object_type | ["post"]   |
+-------------+------------+

# Get capabilities of 'post_tag' taxonomy.
$ wp taxonomy get post_tag --field=cap
{"manage_terms":"manage_categories","edit_terms":"manage_categories","delete_terms":"manage_categories","assign_terms":"edit_posts"}
Gets details about a registered taxonomy .