diff --git a/README.md b/README.md index 2c425b096..ae6997160 100644 --- a/README.md +++ b/README.md @@ -3029,6 +3029,22 @@ wp post-type get [--field=] [--fields=] [--format==] [--field=] [--fields=] [--f **AVAILABLE FIELDS** -These fields will be displayed by default for each term: +These fields will be displayed by default for each post type: * name * label diff --git a/features/post-type.feature b/features/post-type.feature index 0a73beef5..bb0721e9b 100644 --- a/features/post-type.feature +++ b/features/post-type.feature @@ -23,3 +23,11 @@ Feature: Manage WordPress post types | Field | Value | | name | page | | label | Pages | + And STDOUT should contain: + """ + supports + """ + And STDOUT should contain: + """ + "title":true + """ diff --git a/src/Post_Type_Command.php b/src/Post_Type_Command.php index 1dbe8c763..4ff16febd 100644 --- a/src/Post_Type_Command.php +++ b/src/Post_Type_Command.php @@ -62,7 +62,7 @@ class Post_Type_Command extends WP_CLI_Command { * * ## AVAILABLE FIELDS * - * These fields will be displayed by default for each term: + * These fields will be displayed by default for each post type: * * * name * * label @@ -130,6 +130,22 @@ public function list_( $args, $assoc_args ) { * - yaml * --- * + * ## AVAILABLE FIELDS + * + * These fields will be displayed by default for each post type: + * + * * name + * * label + * * description + * * hierarchical + * * public + * * capability_type + * * labels + * * cap + * * supports + * + * There are no optionally available fields. + * * ## EXAMPLES * * # Get details about the 'page' post type. @@ -146,7 +162,8 @@ public function get( $args, $assoc_args ) { if ( empty( $assoc_args['fields'] ) ) { $default_fields = array_merge( $this->fields, array( 'labels', - 'cap' + 'cap', + 'supports', ) ); $assoc_args['fields'] = $default_fields; @@ -161,6 +178,7 @@ public function get( $args, $assoc_args ) { 'capability_type' => $post_type->capability_type, 'labels' => $post_type->labels, 'cap' => $post_type->cap, + 'supports' => get_all_post_type_supports( $post_type->name ), ); $formatter = $this->get_formatter( $assoc_args );