Make WordPress Core

Changeset 37934


Ignore:
Timestamp:
06/30/2016 09:24:59 PM (8 years ago)
Author:
helen
Message:

Meta: Make retrieving registered metadata actually work.

The initial implementation used a single argument, which has now been added to the whitelist.

props Faison.
see #35658.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/meta.php

    r37933 r37934  
    998998 *     @type string $type              The type of data associated with this meta key.
    999999 *     @type string $description       A description of the data attached to this meta key.
     1000 *     @type bool   $single            Whether the meta key has one value per object, or an array of values per object.
    10001001 *     @type string $sanitize_callback A function or method to call when sanitizing `$meta_key` data.
    10011002 *     @type string $auth_callback     Optional. A function or method to call when performing edit_post_meta, add_post_meta, and delete_post_meta capability checks.
     
    10241025        'type'              => 'string',
    10251026        'description'       => '',
     1027        'single'            => false,
    10261028        'sanitize_callback' => null,
    10271029        'auth_callback'     => null,
     
    12261228        }
    12271229        $meta_keys = get_registered_meta_keys( $object_type, $object_subtype );
    1228         $meta_key_data = $meta_keys[ $object_type ][ $object_subtype ][ $meta_key ];
    1229 
    1230         $data = get_metadata( $object_type, $object_id, $meta_key, $meta_key_data->single );
     1230        $meta_key_data = $meta_keys[ $meta_key ];
     1231
     1232        $data = get_metadata( $object_type, $object_id, $meta_key, $meta_key_data['single'] );
    12311233
    12321234        return $data;
Note: See TracChangeset for help on using the changeset viewer.