You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I run `wp term create category "First Category" --porcelain`
427
+
And save STDOUT as {CAT_1}
428
+
And I run `wp term create category "Second Category" --porcelain`
429
+
And save STDOUT as {CAT_2}
430
+
And I run `wp term create post_tag "Term One" --porcelain`
431
+
And I run `wp term create post_tag "Term Two" --porcelain`
432
+
And I run `wp post create --post_title='Test Post' --post_content='Test post content' --tax_input='{"category":[{CAT_1},{CAT_2}],"post_tag":["term-one", "term-two"]}' --porcelain`
433
+
Then STDOUT should be a number
434
+
And save STDOUT as {POST_ID}
435
+
436
+
When I run `wp post term list {POST_ID} category post_tag --format=table --fields=name,taxonomy`
437
+
Then STDOUT should be a table containing rows:
438
+
| name | taxonomy |
439
+
| FirstCategory | category |
440
+
| SecondCategory | category |
441
+
| TermOne | post_tag |
442
+
| TermTwo | post_tag |
443
+
When I run `wp post update {POST_ID} --tax_input='{"category":[{CAT_1}],"post_tag":["term-one"]}'`
444
+
Then STDOUT should contain:
445
+
"""
446
+
Success: Updated post {POST_ID}.
447
+
"""
448
+
449
+
When I run `wp post term list {POST_ID} category post_tag --format=table --fields=name,taxonomy`
450
+
Then STDOUT should be a table containing rows:
451
+
| name | taxonomy |
452
+
| FirstCategory | category |
453
+
| TermOne | post_tag |
454
+
425
455
Scenario: Update categories on a post
426
456
When I run `wp term create category "Test Category" --porcelain`
Copy file name to clipboardExpand all lines: src/Post_Command.php
+76-4Lines changed: 76 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -122,6 +122,8 @@ public function __construct() {
122
122
* [--tax_input=<tax_input>]
123
123
* : Array of taxonomy terms keyed by their taxonomy name. Default empty.
124
124
*
125
+
* Note: In WordPress core, this normally requires a user context to satisfy capability checks. WP-CLI bypasses this for convenience. See https://core.trac.wordpress.org/ticket/19373
126
+
*
125
127
* [--meta_input=<meta_input>]
126
128
* : Array in JSON format of post meta values keyed by their post meta key. Default empty.
127
129
*
@@ -183,7 +185,7 @@ public function create( $args, $assoc_args ) {
* : Array of taxonomy terms keyed by their taxonomy name. Default empty.
299
335
*
336
+
* Note: In WordPress core, this normally requires a user context to satisfy capability checks. WP-CLI bypasses this for convenience. See https://core.trac.wordpress.org/ticket/19373
337
+
*
300
338
* [--meta_input=<meta_input>]
301
339
* : Array in JSON format of post meta values keyed by their post meta key. Default empty.
302
340
*
@@ -348,15 +386,49 @@ public function update( $args, $assoc_args ) {
0 commit comments