Make WordPress Core


Ignore:
Timestamp:
09/05/2008 10:04:04 PM (18 years ago)
Author:
westi
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post.php

    r8796 r8824  
    593593        $meta_cache = wp_cache_get($post_id, 'post_meta');
    594594
     595        if ( !$meta_cache ) {
     596                update_postmeta_cache($post_id);
     597                $meta_cache = wp_cache_get($post_id, 'post_meta');
     598        }
     599
    595600        if ( isset($meta_cache[$key]) ) {
    596601                if ( $single ) {
    597602                        return maybe_unserialize( $meta_cache[$key][0] );
    598603                } else {
    599                         return maybe_unserialize( $meta_cache[$key] );
    600                 }
    601         }
    602 
    603         if ( !$meta_cache ) {
    604                 update_postmeta_cache($post_id);
    605                 $meta_cache = wp_cache_get($post_id, 'post_meta');
    606         }
    607 
    608         if ( $single ) {
    609                 if ( isset($meta_cache[$key][0]) )
    610                         return maybe_unserialize($meta_cache[$key][0]);
    611                 else
    612                         return '';
    613         } else {
    614                 return maybe_unserialize($meta_cache[$key]);
    615         }
     604                        return array_map('maybe_unserialize', $meta_cache[$key]);
     605                }
     606        }
     607
     608        return '';
    616609}
    617610
Note: See TracChangeset for help on using the changeset viewer.