Changeset 8825

Show
Ignore:
Timestamp:
09/05/08 22:06:46 (3 months ago)
Author:
westi
Message:

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

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/2.6/wp-includes/post.php

    r8795 r8825  
    595595    $meta_cache = wp_cache_get($post_id, 'post_meta'); 
    596596 
     597    if ( !$meta_cache ) { 
     598        update_postmeta_cache($post_id); 
     599        $meta_cache = wp_cache_get($post_id, 'post_meta'); 
     600    } 
     601 
    597602    if ( isset($meta_cache[$key]) ) { 
    598603        if ( $single ) { 
    599604            return maybe_unserialize( $meta_cache[$key][0] ); 
    600605        } else { 
    601             return maybe_unserialize( $meta_cache[$key] ); 
    602         } 
    603     } 
    604  
    605     if ( !$meta_cache ) { 
    606         update_postmeta_cache($post_id); 
    607         $meta_cache = wp_cache_get($post_id, 'post_meta'); 
    608     } 
    609  
    610     if ( $single ) { 
    611         if ( isset($meta_cache[$key][0]) ) 
    612             return maybe_unserialize($meta_cache[$key][0]); 
    613         else 
    614             return ''; 
    615     } else { 
    616         return maybe_unserialize($meta_cache[$key]); 
    617     } 
     606            return array_map('maybe_unserialize', $meta_cache[$key]); 
     607        } 
     608    } 
     609 
     610    return ''; 
    618611} 
    619612