WordPress.org

Make WordPress Core

Ticket #19708: 19708.diff

File 19708.diff, 1.2 KB (added by leewillis77, 2 years ago)

Proposed patch

  • wp-includes/post.php

     
    15081508/** 
    15091509 * Retrieve post meta fields, based on post ID. 
    15101510 * 
    1511  * The post meta fields are retrieved from the cache, so the function is 
    1512  * optimized to be called more than once. It also applies to the functions, that 
    1513  * use this function. 
     1511 * The post meta fields are retrieved from the cache where possible, so the 
     1512 * function is optimized to be called more than once. It also applies to the 
     1513 * functions, that use this function. 
    15141514 * 
    15151515 * @since 1.2.0 
    15161516 * @link http://codex.wordpress.org/Function_Reference/get_post_custom 
     
    15261526        if ( ! $post_id ) 
    15271527                $post_id = get_the_ID(); 
    15281528 
    1529         if ( ! wp_cache_get( $post_id, 'post_meta' ) ) 
    1530                 update_postmeta_cache( $post_id ); 
     1529        if ( ! wp_cache_get( $post_id, 'post_meta' ) ) { 
    15311530 
    1532         return wp_cache_get( $post_id, 'post_meta' ); 
     1531        $post_meta = update_postmeta_cache( $post_id ); 
     1532        $post_meta = $post_meta [ $post_id ]; 
     1533        return $post_meta; 
     1534 
     1535    } else { 
     1536 
     1537        return wp_cache_get( $post_id, 'post_meta' ); 
     1538 
     1539    } 
     1540 
    15331541} 
    15341542 
    15351543/**