Changeset 8824

Show
Ignore:
Timestamp:
09/05/08 22:04:04 (3 months 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.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • 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