mirror of
https://github.com/WordPress/WordPress.git
synced 2025-03-09 07:00:01 +00:00
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
This commit is contained in:
parent
11ced9e22e
commit
34e6722704
@ -592,27 +592,20 @@ function get_post_meta($post_id, $key, $single = false) {
|
|||||||
|
|
||||||
$meta_cache = wp_cache_get($post_id, 'post_meta');
|
$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 ) {
|
if ( !$meta_cache ) {
|
||||||
update_postmeta_cache($post_id);
|
update_postmeta_cache($post_id);
|
||||||
$meta_cache = wp_cache_get($post_id, 'post_meta');
|
$meta_cache = wp_cache_get($post_id, 'post_meta');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $single ) {
|
if ( isset($meta_cache[$key]) ) {
|
||||||
if ( isset($meta_cache[$key][0]) )
|
if ( $single ) {
|
||||||
return maybe_unserialize($meta_cache[$key][0]);
|
return maybe_unserialize( $meta_cache[$key][0] );
|
||||||
else
|
} else {
|
||||||
return '';
|
return array_map('maybe_unserialize', $meta_cache[$key]);
|
||||||
} else {
|
}
|
||||||
return maybe_unserialize($meta_cache[$key]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user