#58392 closed enhancement (fixed)
Add $post parameter to the wp_trash_post action.
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 6.3 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Posts, Post Types | Keywords: | has-patch has-unit-tests |
| Focuses: | Cc: |
Description
The $post variable is already available in the wp_trash_post() function so it can just be passed.
Should be the same for the below functions as well to maintain the consistency
trashed_post
untrash_post
untrashed_post
Attachments (2)
Change History (22)
This ticket was mentioned in PR #4499 on WordPress/wordpress-develop by @mujuonly.
3 years ago
#1
- Keywords has-patch added
#2
@
3 years ago
- Keywords changes-requested added
Hi there! thanks for the ticket and PR.
Left one minor feedback.
#3
@
3 years ago
- Keywords dev-feedback added; has-patch changes-requested removed
Hi,
I checked the source code and I saw trashed_post, untrash_post, untrashed_post methods require post id not post and used multiple places. I think post id is the best.
#4
@
3 years ago
- Milestone changed from Awaiting Review to 6.3
Hi there, thanks for the ticket!
Taking a closer look here:
pre_trash_postreceives$post.wp_trash_postreceives$post_id.trashed_postreceives$post_id.pre_untrash_postreceives$postand$previous_status.untrash_postreceives$post_idand$previous_status.untrashed_postreceives$post_idand$previous_status.
See [49125] / #23022 for reference.
It appears that passing $previous_status to the former three hooks would bring more consistency, so 58392.2.diff does just that.
Would that be enough here, or do we still need to pass $post to wp_trash_post and untrash_post? Could you share the use case for that?
This ticket was mentioned in Slack in #core by mukeshpanchal27. View the logs.
3 years ago
#6
@
3 years ago
- Keywords needs-unit-tests added
This ticket was discussed during the bug scrub. As this is new code and to ensure that the parameters are always passed in future, we agreed that this should have a unit test to verify the expected parameters are received.
Additional props: @mukesh27 @oglekler
This ticket was mentioned in Slack in #core by oglekler. View the logs.
3 years ago
This ticket was mentioned in PR #4580 on WordPress/wordpress-develop by @hugod.
3 years ago
#9
- Keywords has-unit-tests added; needs-unit-tests removed
Trac ticket: https://core.trac.wordpress.org/ticket/58392
This PR adds unit tests to the previously proposed diff.
#10
@
3 years ago
Hi,
I added tests in https://github.com/WordPress/wordpress-develop/pull/4580.
Tell me if it lacks of anything.
This ticket was mentioned in Slack in #core by hugod. View the logs.
3 years ago
3 years ago
#13
Hi @audrasjb and @costdev 👋
Thanks for the feedback!
I've split the test and added some docblocks as you suggested.
#15
@
3 years ago
- Owner set to audrasjb
- Status changed from new to reviewing
Self assigning for final review.
This ticket was mentioned in Slack in #core by mukeshpanchal27. View the logs.
2 years ago
#17
@
2 years ago
- Keywords needs-testing added; dev-feedback removed
I am adding needs-testing to highlight that this patch is ready for review.
@audrasjb commented on PR #4580:
2 years ago
#20
committed in https://core.trac.wordpress.org/changeset/56043
Add $post parameter to wp_trash_post action
Trac ticket: https://core.trac.wordpress.org/ticket/58392