maybe_unserialize the array members not the array when multple post meta items are returned. Fixes #7623 for trunk props andy.

git-svn-id: https://develop.svn.wordpress.org/trunk@8824 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Peter Westwood 2008-09-05 22:04:04 +00:00
parent 8b0beb2e8e
commit 1c8fde4885
1 changed files with 8 additions and 15 deletions

View File

@ -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 '';
}
/**