public function get( $args, $assoc_args ) {

		list( $taxonomy, $term ) = $args;

		$term = get_term_by( Utils\get_flag_value( $assoc_args, 'by' ), $term, $taxonomy );

		if ( ! $term ) {
			WP_CLI::error( "Term doesn't exist." );
		}

		if ( empty( $assoc_args['fields'] ) ) {
			$term_array           = get_object_vars( $term );
			$assoc_args['fields'] = array_keys( $term_array );
		}

		$term->count  = (int) $term->count;
		$term->parent = (int) $term->parent;

		$formatter = $this->get_formatter( $assoc_args );
		$formatter->display_item( $term );
	}
public function get( $args, $assoc_args ) {

		list( $taxonomy, $term ) = $args;

		$term = get_term_by( Utils\get_flag_value( $assoc_args, 'by' ), $term, $taxonomy );

		if ( ! $term ) {
			WP_CLI::error( "Term doesn't exist." );
		}

		if ( empty( $assoc_args['fields'] ) ) {
			$term_array           = get_object_vars( $term );
			$assoc_args['fields'] = array_keys( $term_array );
		}

		$term->count  = (int) $term->count;
		$term->parent = (int) $term->parent;

		$formatter = $this->get_formatter( $assoc_args );
		$formatter->display_item( $term );
	}
public function get ( $ args , $ assoc_args ) { list ( $ taxonomy , $ term ) = $ args ; $ term = get_term_by ( Utils \ get_flag_value ( $ assoc_args , 'by' ) , $ term , $ taxonomy ) ; if ( ! $ term ) { WP_CLI :: error ( "Term doesn't exist." ) ; } if ( empty ( $ assoc_args [ 'fields' ] ) ) { $ term_array = get_object_vars ( $ term ) ; $ assoc_args [ 'fields' ] = array_keys ( $ term_array ) ; } $ term -> count = ( int ) $ term -> count ; $ term -> parent = ( int ) $ term -> parent ; $ formatter = $ this -> get_formatter ( $ assoc_args ) ; $ formatter -> display_item ( $ term ) ; }
Gets details about a term.

## OPTIONS

<taxonomy>
: Taxonomy of the term to get

<term>
: ID or slug of the term to get

[--by=<field>]
: Explicitly handle the term value as a slug or id.
---
default: id
options:
- slug
- id
---

[--field=<field>]
: Instead of returning the whole term, 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
---

## EXAMPLES

# Get details about a category with id 199.
$ wp term get category 199 --format=json
{"term_id":199,"name":"Apple","slug":"apple","term_group":0,"term_taxonomy_id":199,"taxonomy":"category","description":"A type of fruit","parent":0,"count":0,"filter":"raw"}

# Get details about a category with slug apple.
$ wp term get category apple --by=slug --format=json
{"term_id":199,"name":"Apple","slug":"apple","term_group":0,"term_taxonomy_id":199,"taxonomy":"category","description":"A type of fruit","parent":0,"count":0,"filter":"raw"}
Gets details about a term .