public function get( $args, $assoc_args ) {
		$post_type = get_post_type_object( $args[0] );

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

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

			$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( [ $post_type->name ] );
			$count = $count[ $post_type->name ];
		}

		$data = array(
			'name'            => $post_type->name,
			'label'           => $post_type->label,
			'description'     => $post_type->description,
			'hierarchical'    => $post_type->hierarchical,
			'public'          => $post_type->public,
			'capability_type' => $post_type->capability_type,
			'labels'          => $post_type->labels,
			'cap'             => $post_type->cap,
			'supports'        => get_all_post_type_supports( $post_type->name ),
			'count'           => $count,
		);
		$formatter->display_item( $data );
	}
public function get( $args, $assoc_args ) {
		$post_type = get_post_type_object( $args[0] );

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

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

			$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( [ $post_type->name ] );
			$count = $count[ $post_type->name ];
		}

		$data = array(
			'name'            => $post_type->name,
			'label'           => $post_type->label,
			'description'     => $post_type->description,
			'hierarchical'    => $post_type->hierarchical,
			'public'          => $post_type->public,
			'capability_type' => $post_type->capability_type,
			'labels'          => $post_type->labels,
			'cap'             => $post_type->cap,
			'supports'        => get_all_post_type_supports( $post_type->name ),
			'count'           => $count,
		);
		$formatter->display_item( $data );
	}
public function get ( $ args , $ assoc_args ) { $ post_type = get_post_type_object ( $ args [ 0 ] ) ; if ( ! $ post_type ) { WP_CLI :: error ( "Post type {$args[0]} doesn't exist." ) ; } if ( empty ( $ assoc_args [ 'fields' ] ) ) { $ default_fields = array_merge ( $ this -> fields , array ( 'labels' , 'cap' , 'supports' , ) ) ; $ 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 ( [ $ post_type -> name ] ) ; $ count = $ count [ $ post_type -> name ] ; } $ data = array ( 'name' => $ post_type -> name , 'label' => $ post_type -> label , 'description' => $ post_type -> description , 'hierarchical' => $ post_type -> hierarchical , 'public' => $ post_type -> public , 'capability_type' => $ post_type -> capability_type , 'labels' => $ post_type -> labels , 'cap' => $ post_type -> cap , 'supports' => get_all_post_type_supports ( $ post_type -> name ) , 'count' => $ count , ) ; $ formatter -> display_item ( $ data ) ; }
Gets details about a registered post type.

## OPTIONS

<post-type>
: Post type 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 post type:

* name
* label
* description
* hierarchical
* public
* capability_type
* labels
* cap
* supports

These fields are optionally available:

* count

## EXAMPLES

# Get details about the 'page' post type.
$ wp post-type get page --fields=name,label,hierarchical --format=json
{"name":"page","label":"Pages","hierarchical":true}
Gets details about a registered post type .