WordPress.org

Make WordPress Core

Ticket #16895: 16895.3.patch

File 16895.3.patch, 757 bytes (added by hakre, 7 years ago)

allow references in fields

  • wp-includes/functions.php

    ### Eclipse Workspace Patch 1.0
    #P wordpress-trunk
     
    30893089 *
    30903090 * @param array $list A list of objects or arrays
    30913091 * @param int|string $field A field from the object to place instead of the entire object
    3092  * @return array
     3092 * @return array All field values of the input list
    30933093 */
    30943094function wp_list_pluck( $list, $field ) {
     3095        $fields = array();
    30953096        foreach ( $list as $key => $value ) {
    30963097                $value = (array) $value;
    3097                 $list[ $key ] = $value[ $field ];
     3098                $fields[ $key ] = & $value[ $field ];
    30983099        }
    30993100
    3100         return $list;
     3101        return $fields;
    31013102}
    31023103
    31033104/**