Make WordPress Core

Opened 13 years ago

Closed 11 years ago

Last modified 11 years ago

#18823 closed enhancement (wontfix)

Pass $post_id as second argument to delete_postmeta action

Reported by: vynce's profile 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)

#1 @duck_
13 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.

#2 @c3mdigital
11 years 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.

#3 @SergeyBiryukov
11 years ago

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