WordPress.org

Make WordPress Core

Ticket #18230: 18230.diff

File 18230.diff, 499 bytes (added by Otto42, 3 years ago)

optimize wp_list_pluck a little bit

  • wp-includes/functions.php

     
    32023202 */ 
    32033203function wp_list_pluck( $list, $field ) { 
    32043204        foreach ( $list as $key => $value ) { 
    3205                 $value = (array) $value; 
    3206                 $list[ $key ] = $value[ $field ]; 
     3205                if ( is_object( $value ) ) $list[ $key ] = $value->$field; 
     3206                else $list[ $key ] = $value[ $field ]; 
    32073207        } 
    32083208 
    32093209        return $list;