WordPress.org

Make WordPress Core

Ticket #43949: 43949.diff

File 43949.diff, 1.5 KB (added by samirmalpande, 2 years ago)
  • src/wp-includes/meta.php

    diff --git a/src/wp-includes/meta.php b/src/wp-includes/meta.php
    index 7959be5576..8599d24d8c 100644
    a b function get_metadata( $meta_type, $object_id, $meta_key = '', $single = false ) 
    502502         * @param bool              $single    Whether to return only the first value of the specified $meta_key.
    503503         */
    504504        $check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, $single );
     505       
    505506        if ( null !== $check ) {
    506507                if ( $single && is_array( $check ) ) {
    507508                        return $check[0];
    function get_metadata( $meta_type, $object_id, $meta_key = '', $single = false ) 
    516517                $meta_cache = update_meta_cache( $meta_type, array( $object_id ) );
    517518                $meta_cache = $meta_cache[ $object_id ];
    518519        }
     520       
     521        /**
     522     * Filters whether to retrieve meta cache of a specific type.
     523     *
     524     * The dynamic portion of the hook, `$meta_type`, refers to the meta
     525     * object type (comment, post, or user).
     526     *
     527     * @param array $value     The value get_metadata() should return - a single metadata value, or an array of values.
     528     * @param array             $meta_cache Array to be Filtered.
     529     * @param int               $object_id Object ID.
     530     * @param string            $meta_key  Meta key.
     531     * @param bool              $single    Whether to return only the first value of the specified $meta_key.
     532     */
     533
     534    $meta_cache = apply_filters( "get_{$meta_type}_meta_cache", $meta_cache, $object_id, $meta_key, $single );
    519535
    520536        if ( ! $meta_key ) {
    521537                return $meta_cache;