Commit 317e976
committed
Fix: allow
Use wp_trash_post() directly instead of wp_delete_post() for the
trash path, because wp_delete_post() hardcodes auto-trash behavior
to only 'post' and 'page' types (WordPress core #43672), permanently
deleting all other post types even when $force_delete is false.
wp_trash_post() works correctly for all post types, so we call it
directly when --force is not set and EMPTY_TRASH_DAYS is enabled.
Previously, `wp post delete` on a custom post type would error:
'Posts of type X do not support being sent to trash.'
Now it trashes the post like it does for 'post' and 'page' types.
Closes #128.wp post delete to trash custom post types1 parent defb5ea commit 317e976
2 files changed
Lines changed: 35 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | | - | |
| 44 | + | |
| 45 | + | |
46 | 46 | | |
47 | | - | |
48 | | - | |
| 47 | + | |
49 | 48 | | |
50 | 49 | | |
51 | | - | |
| 50 | + | |
52 | 51 | | |
53 | 52 | | |
54 | 53 | | |
55 | 54 | | |
56 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
57 | 67 | | |
58 | 68 | | |
59 | 69 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
506 | 506 | | |
507 | 507 | | |
508 | 508 | | |
509 | | - | |
510 | | - | |
511 | | - | |
512 | | - | |
513 | | - | |
514 | | - | |
515 | | - | |
516 | | - | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
517 | 515 | | |
518 | 516 | | |
519 | | - | |
520 | | - | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
521 | 522 | | |
522 | 523 | | |
523 | | - | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
524 | 532 | | |
525 | | - | |
| 533 | + | |
526 | 534 | | |
527 | 535 | | |
528 | 536 | | |
| |||
0 commit comments