WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 8 months ago

Last modified 8 months ago

#18823 closed enhancement (wontfix)

Pass $post_id as second argument to delete_postmeta action

Reported by: Vynce Owned by:
Milestone: Priority: normal
Severity: minor Version: 3.2
Component: General Keywords:
Focuses: Cc:

Description

in every case (in WP 3.2) where a postmeta is deleted, the context is aware of the post_id or post_ids affected. The do_action calls for added_postmeta, update_postmeta, and updated_postmeta all pass the post_id as the second argument. For parallelism, and because it is useful, please pass it for delete_postmeta (and deleted_postmeta).

Change History (3)

comment:1 duck_3 years ago

I think that the extra values weren't passed for delete_postmeta as this action is used in two different circumstances. delete_meta and delete_post_meta_by_key act on different information. The former takes a specific meta id which is tied to one object, the latter can delete meta from multiple objects. See #10750 and [11968] for the original introduction of the action. We might want to think about this before changing something. However, they are already inconsistent in what type of data gets passed...

The delete(d)_postmeta actions are also passed arrays and integers inconsistently (delete_meta vs. delete_post_meta_by_key again). Though this isn't new it could be fixed, but I'm unsure how this may affect back compat.

See #18825 for a ticket I opened about backwards incompatibility in these actions in 3.3.

comment:2 c3mdigital8 months ago

  • Resolution set to wontfix
  • Status changed from new to closed

I don't think this is something needed for the old style action delete_postmeta since do_action( "delete_{$meta_type}_meta", $meta_ids, $object_id, $meta_key, $_meta_value ); is available to use.

comment:3 SergeyBiryukov8 months ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.