[wp-trac] [WordPress Trac] #58392: Add $post parameter to the wp_trash_post action.

WordPress Trac noreply at wordpress.org
Mon May 29 15:13:40 UTC 2023


#58392: Add $post parameter to the wp_trash_post action.
-------------------------------+---------------------
 Reporter:  mujuonly           |       Owner:  (none)
     Type:  enhancement        |      Status:  new
 Priority:  normal             |   Milestone:  6.3
Component:  Posts, Post Types  |     Version:
 Severity:  normal             |  Resolution:
 Keywords:  dev-feedback       |     Focuses:
-------------------------------+---------------------
Changes (by SergeyBiryukov):

 * milestone:  Awaiting Review => 6.3


Comment:

 Hi there, thanks for the ticket!

 Taking a closer look here:
 * `pre_trash_post` receives `$post`.
 * `wp_trash_post` receives `$post_id`.
 * `trashed_post` receives `$post_id`.
 * `pre_untrash_post` receives `$post` and `$previous_status`.
 * `untrash_post` receives `$post_id` and `$previous_status`.
 * `untrashed_post` receives `$post_id` and `$previous_status`.

 See [49125] / #23022 for reference.

 It appears that passing `$previous_status` to the former three hooks would
 bring more consistency, so [attachment:"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?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58392#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list