Skip to content

Commit 24be0e5

Browse files
Copilotswissspidy
andcommitted
Add term_group to default fields in Term_Command
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
1 parent 6df8d84 commit 24be0e5

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

features/term.feature

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,3 +280,21 @@ Feature: Manage WordPress terms
280280
"""
281281
Success: Term updated.
282282
"""
283+
284+
Scenario: Term list includes term_group field
285+
When I run `wp term create category 'Group Test' --slug=group-test --description='Test term_group field'`
286+
Then STDOUT should not be empty
287+
288+
When I run `wp term list category --format=csv --fields=name,term_group`
289+
Then STDOUT should contain:
290+
"""
291+
term_group
292+
"""
293+
294+
When I run `wp term list category --format=json`
295+
Then STDOUT should be JSON containing:
296+
"""
297+
[{
298+
"term_group":0
299+
}]
300+
"""

src/Term_Command.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class Term_Command extends WP_CLI_Command {
4747
'description',
4848
'parent',
4949
'count',
50+
'term_group',
5051
];
5152

5253
/**
@@ -90,6 +91,7 @@ class Term_Command extends WP_CLI_Command {
9091
* * description
9192
* * parent
9293
* * count
94+
* * term_group
9395
*
9496
* These fields are optionally available:
9597
*
@@ -99,11 +101,11 @@ class Term_Command extends WP_CLI_Command {
99101
*
100102
* # List post categories
101103
* $ wp term list category --format=csv
102-
* term_id,term_taxonomy_id,name,slug,description,parent,count
103-
* 2,2,aciform,aciform,,0,1
104-
* 3,3,antiquarianism,antiquarianism,,0,1
105-
* 4,4,arrangement,arrangement,,0,1
106-
* 5,5,asmodeus,asmodeus,,0,1
104+
* term_id,term_taxonomy_id,name,slug,description,parent,count,term_group
105+
* 2,2,aciform,aciform,,0,1,0
106+
* 3,3,antiquarianism,antiquarianism,,0,1,0
107+
* 4,4,arrangement,arrangement,,0,1,0
108+
* 5,5,asmodeus,asmodeus,,0,1,0
107109
*
108110
* # List post tags
109111
* $ wp term list post_tag --fields=name,slug

0 commit comments

Comments
 (0)