WordPress.org

Make WordPress Core

Changeset 19906


Ignore:
Timestamp:
02/10/2012 10:00:37 PM (8 years ago)
Author:
duck_
Message:

Make get_post_custom() a wrapper of get_post_meta() so that it works when cache addition is suspended and to simplify it.

Props leewillis77 for the initial patch. Fixes #19708.

File:
1 edited

Legend:

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

    r19853 r19906  
    15141514 * Retrieve post meta fields, based on post ID.
    15151515 *
    1516  * The post meta fields are retrieved from the cache, so the function is
    1517  * optimized to be called more than once. It also applies to the functions, that
    1518  * use this function.
     1516 * The post meta fields are retrieved from the cache where possible,
     1517 * so the function is optimized to be called more than once.
    15191518 *
    15201519 * @since 1.2.0
    15211520 * @link http://codex.wordpress.org/Function_Reference/get_post_custom
    15221521 *
    1523  * @uses $id Current Loop Post ID
    1524  *
    1525  * @param int $post_id post ID
     1522 * @param int $post_id Post ID.
    15261523 * @return array
    15271524 */
    15281525function get_post_custom( $post_id = 0 ) {
    15291526    $post_id = absint( $post_id );
    1530 
    15311527    if ( ! $post_id )
    15321528        $post_id = get_the_ID();
    15331529
    1534     if ( ! wp_cache_get( $post_id, 'post_meta' ) )
    1535         update_postmeta_cache( $post_id );
    1536 
    1537     return wp_cache_get( $post_id, 'post_meta' );
     1530    return get_post_meta( $post_id, '' );
    15381531}
    15391532
Note: See TracChangeset for help on using the changeset viewer.