#2160 closed defect (bug) (fixed)
get_post_custom_values() broken?
Reported by: | jasontromm | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | major | Version: | 2.0 |
Component: | Template | Keywords: | meta tags custom values template functions bg|has-patch bg|commit |
Focuses: | Cc: |
Description
get_post_custom_values() appears to be broken in WP 2.0. I know there are entries in the wp_postmeta table for the entry I'm looking at, but they're not retrieved by get_post_custom_values(). (I'm using the multi-topic-icon plugin.)
Attachments (5)
Change History (15)
#6
@
19 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
I'm reopening the ticket because the logic in the fix makes no sense.
If no $key
param is provided get_post_custom_values() returns $post_meta_cache[$id]
, but with a $key
it returns the output of get_post_custom(). That's effectively the same thing!
Providing a {$}key never returns values for that key, but rather an array of all keys and values.
#7
@
19 years ago
I'm uploading a patch which reverts get_post_custom_values() to its original intent, at least when $key param is provided.
@
19 years ago
Has get_post_custom_values() return $post_meta_cache[$id][$key] if $key param provided.
I'm not entirely sure as to how that function should work, so I guessed. It was the same in 1.5.2 as it is now, but that is a buggy state. I've attached a patch that works in the following way:
get_post_custom_values() has an optional values parameter. If you pass it, the function will return all values with that key. If you don't pass it, or you pass an empty parameter, the function acts exactly like get_post_custom (in fact, it just calls get_post_custom :))