#11683 closed defect (bug) (fixed)
update_metadata() passes only the first meta_id
Reported by: | scribu | Owned by: | boonebgorges |
---|---|---|---|
Milestone: | 4.1 | Priority: | normal |
Severity: | normal | Version: | 2.9 |
Component: | Options, Meta APIs | Keywords: | has-patch |
Focuses: | Cc: |
Description
Code to reproduce:
function update_metadata_action_test($meta_id) { var_dump($meta_id); } add_action('update_post_meta', 'update_metadata_action_test'); add_metadata('post', 1, 'mykey', 'value1'); add_metadata('post', 1, 'mykey', 'value2'); update_metadata('post', 1, 'mykey', 'new value');
Expected result:
Array ( [0] => 101 [1] => 102 )
Actual result:
string(3) "101"
Attachments (3)
Change History (22)
#3
@
15 years ago
Come to think of it, I have no ideea why $meta_id is passed at all (and as the first parameter at that). It's not accesible from anywhere else in the API.
#6
@
12 years ago
- Keywords has-patch added
Added patch to get all meta_ids and call actions on all meta_ids individually, rather than breaking current behavior by passing arrays.
#7
@
12 years ago
I've never really noticed that update_metadata() can update more than one row at a time.
#8
@
12 years ago
- Milestone changed from Future Release to 3.6
Patch refreshed against trunk like whoa - passes all Unit Tests
#14
@
10 years ago
- Milestone changed from Future Release to 4.1
- Owner set to boonebgorges
- Status changed from new to accepted
11683.2.diff refreshes for latest trunk, and adds some Delightful unit tests.
#16
@
10 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
The hook docs always need to directly precede the hook line so the parser can match them up.
#19
in reply to:
↑ 17
@
10 years ago
Replying to boonebgorges:
You learn something new every day :) Thanks, DrewAPicture.
Absolutely :-)
In the case of hooks, it's particularly important because phpDocumentor doesn't actually support parsing hook docs out of the box. Our implementation calls for the docs to directly precede hook lines so they don't get confused with function-level DocBlocks.
Two solutions:
The first would create more severe backward compatibility issues than the second.