Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#11125 closed defect (bug) (fixed)

added_{$meta_type}_meta, and update_{$meta_type}_meta actions have inconsistent arguments

Reported by: mdawaffe Owned by: mdawaffe
Milestone: 2.9 Priority: normal
Severity: major Version:
Component: General Keywords: has-patch dev-feedback
Focuses: Cc:


added_{$meta_type}_meta: $wpdb->insert_id, $object_id, $meta_key, $meta_value

update_{$meta_type}_meta: $object_id, $meta_key, $meta_value, $meta_id

In the former, $meta_id is first. In the later, $meta_id is last.

They should have the same argument order.

Attachments (2)

11125.diff (465 bytes) - added by mdawaffe 9 years ago.
11125.b.diff (999 bytes) - added by mdawaffe 9 years ago.

Download all attachments as: .zip

Change History (6)

#1 follow-up: @mdawaffe
9 years ago

delete_metadata calls the following hook:

deleted_{$meta_type}_meta: $object_id, $meta_key, $meta_value, $meta_ids

I suggest all the metadata hooks use that order (object_id, key, value, meta_id).

9 years ago

#2 @mdawaffe
9 years ago

  • Keywords has-patch dev-feedback added
  • Owner set to mdawaffe
  • Status changed from new to accepted

9 years ago

#3 in reply to: ↑ 1 @mdawaffe
9 years ago

  • Severity changed from normal to major

Replying to mdawaffe:

I suggest all the metadata hooks use that order (object_id, key, value, meta_id).

That suggestion is a bad one.

The actions need to have arguments in the following order instead.

meta_id(s), object_id, key, value

I didn't realize that in addition to the (added|updated|update|deleted)_{$meta_type}_meta actions, there were already pre-existing (added|updated|update|deleted)_(post|user)_meta actions. These pre-existing actions all use the above argument order.

New patch puts them in the correct order.

Bumping severity since it's now a real bug, not just a new inconsistency.

#4 @ryan
9 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

(In [12173]) Fix argument order. Props mdawaffe. fixes #11125

Note: See TracTickets for help on using tickets.