From 34e672270480ced498b3724260b57944b965d6e7 Mon Sep 17 00:00:00 2001 From: westi Date: Fri, 5 Sep 2008 22:04:04 +0000 Subject: [PATCH] maybe_unserialize the array members not the array when multple post meta items are returned. Fixes #7623 for trunk props andy. git-svn-id: http://svn.automattic.com/wordpress/trunk@8824 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/post.php | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/wp-includes/post.php b/wp-includes/post.php index f5377f7fb1..9eb37a1d1f 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -592,27 +592,20 @@ function get_post_meta($post_id, $key, $single = false) { $meta_cache = wp_cache_get($post_id, 'post_meta'); - if ( isset($meta_cache[$key]) ) { - if ( $single ) { - return maybe_unserialize( $meta_cache[$key][0] ); - } else { - return maybe_unserialize( $meta_cache[$key] ); - } - } - if ( !$meta_cache ) { update_postmeta_cache($post_id); $meta_cache = wp_cache_get($post_id, 'post_meta'); } - if ( $single ) { - if ( isset($meta_cache[$key][0]) ) - return maybe_unserialize($meta_cache[$key][0]); - else - return ''; - } else { - return maybe_unserialize($meta_cache[$key]); + if ( isset($meta_cache[$key]) ) { + if ( $single ) { + return maybe_unserialize( $meta_cache[$key][0] ); + } else { + return array_map('maybe_unserialize', $meta_cache[$key]); + } } + + return ''; } /**