-
Notifications
You must be signed in to change notification settings - Fork 95
Open
Description
Bug Report
Describe the current, buggy behavior
The wp post delete command has this example
entity-command/src/Post_Command.php
Lines 463 to 466 in 1b65952
| * # Delete all posts in the trash | |
| * $ wp post delete $(wp post list --post_status=trash --format=ids) | |
| * Success: Deleted post 1268. | |
| * Success: Deleted post 1294. |
Running this example for a custom post type doesn't work because the --force flag is missing, introduced in #188.
Describe how other contributors can replicate this bug
- Create a CPT
- Create a post for that CPT and trash it manually
- Now try to delete the post
Describe what you would expect as the correct outcome
The post should be deleted without a warning because it's already in trash.
Provide a possible solution
Skip the check in
entity-command/src/Post_Command.php
Lines 486 to 493 in 1b65952
| if ( ! $assoc_args['force'] | |
| && ( 'post' !== $post_type && 'page' !== $post_type ) ) { | |
| return [ | |
| 'error', | |
| "Posts of type '{$post_type}' do not support being sent to trash.\n" | |
| . 'Please use the --force flag to skip trash and delete them permanently.', | |
| ]; | |
| } |
$status is trash.Copilot