Ticket #2160 (closed defect: fixed)

Opened 3 years ago

Last modified 2 years ago

get_post_custom_values() broken?

Reported by: jasontromm Assigned to: anonymous
Priority: normal Milestone:
Component: Template Version: 2.0
Severity: major Keywords: meta tags custom values template functions bg|has-patch bg|commit
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

2160.diff (0.8 kB) - added by davidhouse on 12/29/05 16:20:16.
2160.2.diff (476 bytes) - added by davidhouse on 12/29/05 16:20:48.
minus debugging cruft
2160.3.diff (476 bytes) - added by davidhouse on 12/29/05 16:20:49.
minus debugging cruft
get_post_custom_values.patch (359 bytes) - added by Kafkaesqui on 01/25/06 06:02:44.
Has get_post_custom_values() return $post_meta_cache[$id][$key] if $key param provided.
meta.diff (3.4 kB) - added by ryan on 01/25/06 07:28:22.
post custom cleanup

Change History

12/29/05 16:15:31 changed by davidhouse

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 :))

12/29/05 16:20:16 changed by davidhouse

  • attachment 2160.diff added.

12/29/05 16:20:48 changed by davidhouse

  • attachment 2160.2.diff added.

minus debugging cruft

12/29/05 16:20:49 changed by davidhouse

  • attachment 2160.3.diff added.

minus debugging cruft

12/30/05 10:48:29 changed by davidhouse

  • keywords changed from meta tags custom values template functions to meta tags custom values template functions bg|has-patch.

12/31/05 19:43:37 changed by davidhouse

  • keywords changed from meta tags custom values template functions bg|has-patch to meta tags custom values template functions bg|has-patch bg|commit.

01/06/06 11:42:02 changed by davidhouse

  • milestone set to 2.0.1.

01/17/06 01:01:19 changed by matt

  • status changed from new to closed.
  • resolution set to fixed.

(In [3448]) get_post_custom_values update. Fixes #2160

01/25/06 05:46:04 changed by Kafkaesqui

  • status changed from closed to reopened.
  • resolution deleted.

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.

01/25/06 06:01:08 changed by Kafkaesqui

I'm uploading a patch which reverts get_post_custom_values() to its original intent, at least when $key param is provided.

01/25/06 06:02:44 changed by Kafkaesqui

  • attachment get_post_custom_values.patch added.

Has get_post_custom_values() return $post_meta_cache[$id][$key] if $key param provided.

01/25/06 07:28:22 changed by ryan

  • attachment meta.diff added.

post custom cleanup

01/25/06 07:29:08 changed by ryan

More comprehensive patch that cleans up post_custom a bit.

01/25/06 07:38:45 changed by ryan

  • status changed from reopened to closed.
  • resolution set to fixed.

(In [3486]) post_custom cleanup. fixes #2160

11/30/06 19:41:49 changed by

  • milestone deleted.

Milestone 2.0.1 deleted