Ticket #7623: 7623.diff

File 7623.diff, 978 bytes (added by andy, 4 years ago)
  • trunk/wp-includes/post.php

     
    578578 
    579579        $meta_cache = wp_cache_get($post_id, 'post_meta'); 
    580580 
     581        if ( !$meta_cache ) { 
     582                update_postmeta_cache($post_id); 
     583                $meta_cache = wp_cache_get($post_id, 'post_meta'); 
     584        } 
     585 
    581586        if ( isset($meta_cache[$key]) ) { 
    582587                if ( $single ) { 
    583588                        return maybe_unserialize( $meta_cache[$key][0] ); 
    584589                } else { 
    585                         return maybe_unserialize( $meta_cache[$key] ); 
     590                        return array_map('maybe_unserialize', $meta_cache[$key]); 
    586591                } 
    587592        } 
    588593 
    589         if ( !$meta_cache ) { 
    590                 update_postmeta_cache($post_id); 
    591                 $meta_cache = wp_cache_get($post_id, 'post_meta'); 
    592         } 
    593  
    594         if ( $single ) { 
    595                 if ( isset($meta_cache[$key][0]) ) 
    596                         return maybe_unserialize($meta_cache[$key][0]); 
    597                 else 
    598                         return ''; 
    599         } else { 
    600                 return maybe_unserialize($meta_cache[$key]); 
    601         } 
     594        return ''; 
    602595} 
    603596 
    604597/**